Gamestudio Links
Zorro Links
Newest Posts
New Zorro version 2.03
by laz
12 minutes 38 seconds ago
Texture Shifting
by Superku
13 minutes 26 seconds ago
What are you working on?
by Superku
30 minutes 55 seconds ago
About strategy optimization
by Spirit
Today at 14:13
Help in analysis...
by MINER
Today at 09:56
TradeVars not working with pending trades
by jcl
Today at 08:17
Creating a Directory
by txesmi
Yesterday at 10:15
AUM Magazine
Latest Screens
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Who's Online
16 registered (Ayumi, kvm, Dalla, Quad, GPEngine, alibaba, Iglarion, misiek, 3 invisible), 640 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
Pelin27, Aziz, lucianopneto, j45p41, Max_Ahn
18173 Registered Users
Page 2 of 2 < 1 2
Topic Options
Rate This Topic
#476279 - 02/10/19 10:59 Re: file_append, file_appendfront [Re: MatPed]
MatPed Offline
User

Registered: 02/28/15
Posts: 535
Loc: Milano, Italy
Trying to parse a simple csv:

1371,EUR/USD,TRD,79701,-0.055
1371,EUR/USD,TRD,79703,-0.055
1371,EUR/USD,TRD,82601,-0.102
1371,EUR/USD,TRD,86602,1.117
1371,EUR/USD,TRD,86802,1.373

The format I use:
string sFormat = "0,i,sss,sss,i,f";

this is the testing code:
Code:
#define _storedRER "Data\storedRER.csv"
#define _storedTradeSize 50000 //1.000 trades (1.000 char [50])
#define _sTradeSize 50

void storeTrade(){
	int iCounter = 0;
	char sTrade[_sTradeSize];
	string sDel=",", ls;
	string sFormat =  "%i%s%s%s%s%s%i%s%.3f";

	for(closed_trades){
		if (TradeIsPhantom && TradeIsClosed && TradeBarClose == Bar){
			if(TradeIsShort) ls = "S"; else ls = "L";		
			sprintf(sTrade, sFormat, TradeBarClose, sDel, TradeAsset, sDel, TradeAlgo, sDel, TradeID, sDel, TradeProfit );	
			strcat (sTrade, "rn");
			file_appendfront(_storedRER, sTrade, 0); 	
//			printf("n");
//			print(TO_WINDOW ,"n%s", sTrade);
		}
	}
}

void readTrade(){
//	string sFormat = "%i%s%s%s%s%s%i%s%.3f";
	string sFormat = "0,i,sss,sss,i,f";

	int iHandle, iCounter;
	iCounter = dataParse(iHandle, sFormat, _storedRER); //, sFilter
	
	printf("n%i", iCounter);
	dataNew(iHandle,0,0); 
}

void main() {
	set(LOGFILE); 	
	Verbose = 7|DIAG;
	
	readTrade();
}



No info is generated in the log file.
The output is always 0.

2 questions:
- Why no data are parsed?
- If I want to filter the data set only EUR/USD is the filter string ",EUR/USD,,," correct?

Thank you

Top
#476299 - 02/15/19 10:39 Re: file_append, file_appendfront [Re: MatPed]
MatPed Offline
User

Registered: 02/28/15
Posts: 535
Loc: Milano, Italy
Any idea? Thx

Top
#476300 - 02/15/19 10:43 Re: file_append, file_appendfront [Re: MatPed]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26747
Loc: Frankfurt
For debugging your parsing, you can find instructions and advices under "remarks" on the dataParse manual page. Your filter string makes no sense. You can only filter strings that really appear in your csv, like "EUR/USD", but not ",EUR/USD,,,".

Top
#476301 - 02/15/19 11:27 Re: file_append, file_appendfront [Re: jcl]
MatPed Offline
User

Registered: 02/28/15
Posts: 535
Loc: Milano, Italy
I have seen the remarks, but I do not understand it.
With verbose = 7 I have no message in the log list and I have not seen many examples of the filter.
Are the dataparse functions standard C maybe I can use standard documentations? If not maybe some more hints or examples could be useful, not only for me.
Anyway I will keep on trying

Top
#476302 - 02/15/19 13:23 Re: file_append, file_appendfront [Re: MatPed]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26747
Loc: Frankfurt
C has no standard CSV parsing function. I've reworded the format string description - check the online version, maybe it's more clear now. There are many examples. Still, for some reason people have often problems to understand parsing CSV files - you're not the only one. We provide a conversion service if nothing else helps.

Top
#476303 - 02/15/19 14:02 Re: file_append, file_appendfront [Re: jcl]
MatPed Offline
User

Registered: 02/28/15
Posts: 535
Loc: Milano, Italy
Thank you, I will give it a looks. I am not converting I'd like to use it in order to store trade results in order to keep tracks after zorro restarts. I have only to read it, but i do not find the way how to do it...

Top
Page 2 of 2 < 1 2



Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de