Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (degenerate_762), 1,098 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 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: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
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: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
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: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
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: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
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: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
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: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

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

Moderated by  Petra 

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