Gamestudio Links
Zorro Links
Newest Posts
no trade when there is a negative trained WFOcycle
by maxwellreturn. 08/24/19 22:33
Skip Stepcycle
by maxwellreturn. 08/24/19 22:27
Script filename
by MatPed. 08/24/19 20:49
Any Old Timers Still Around?
by pyramide. 08/24/19 18:23
Oanda FIFO issue?
by AndrewAMD. 08/24/19 12:10
IG plugin initial release
by Dalla. 08/24/19 06:06
Tutorial for Vector Graphics
by Dooley. 08/23/19 22:32
Issue with dataParse function
by byakuren81. 08/23/19 21:57
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
1 registered members (AndrewAMD), 627 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Ysbail, trader4321, GorgonzolaBYTE, Southqvist, tawin
18272 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: file_append, file_appendfront [Re: MatPed] #476279
02/10/19 09:59
02/10/19 09:59
Joined: Feb 2015
Posts: 561
Milano, Italy
M
MatPed Online OP
User
MatPed  Online OP
User
M

Joined: Feb 2015
Posts: 561
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

Re: file_append, file_appendfront [Re: MatPed] #476299
02/15/19 09:39
02/15/19 09:39
Joined: Feb 2015
Posts: 561
Milano, Italy
M
MatPed Online OP
User
MatPed  Online OP
User
M

Joined: Feb 2015
Posts: 561
Milano, Italy
Any idea? Thx

Re: file_append, file_appendfront [Re: MatPed] #476300
02/15/19 09:43
02/15/19 09:43
Joined: Jul 2000
Posts: 26,996
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 26,996
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,,,".

Re: file_append, file_appendfront [Re: jcl] #476301
02/15/19 10:27
02/15/19 10:27
Joined: Feb 2015
Posts: 561
Milano, Italy
M
MatPed Online OP
User
MatPed  Online OP
User
M

Joined: Feb 2015
Posts: 561
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

Re: file_append, file_appendfront [Re: MatPed] #476302
02/15/19 12:23
02/15/19 12:23
Joined: Jul 2000
Posts: 26,996
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 26,996
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.

Re: file_append, file_appendfront [Re: jcl] #476303
02/15/19 13:02
02/15/19 13:02
Joined: Feb 2015
Posts: 561
Milano, Italy
M
MatPed Online OP
User
MatPed  Online OP
User
M

Joined: Feb 2015
Posts: 561
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...

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

Powered by UBB.threads™ PHP Forum Software 7.7.1