Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TedMar, dr_panther), 1,049 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Save trade stats between Zorro restarts [Re: dusktrader] #437236
02/12/14 16:58
02/12/14 16:58
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
Bingo!! I think the file-naming was the entire issue. Everything seems to work as expected now, as far as I can tell.

I also learned that I need to put the if(is(INITRUN)) checks higher up in my script. I had them below some other functions and they were not working. I've now located them just below the BarPeriod= line.

So the main issue was that the same form of selecting asset() must be used in both the loadStats() saveStats() and run() functions, otherwise Zorro expects a different naming convention. For this example, I've used:
Code:
while(asset(loop("EURUSD")))


(even though there is only 1 asset, this is a prototype that will eventually have multiple assets)

and here is the final code I've located just below my BarPeriod= line:
Code:
static int numOpenLastCheck; //track changes in trade open/closes
if(is(INITRUN)) numOpenLastCheck=0;
if(is(INITRUN)) loadStats("dt-e9-htc-30min.ini"); //load most recent stats that were saved to disk
if(NumOpenTotal != numOpenLastCheck)
{
	saveStats("dt-e9-htc-30min.ini"); //save stats to disk upon trade count changes
	numOpenLastCheck = NumOpenTotal;
}



Quote:
Login MT4...
Broker: IBFX, Inc. connected at UTC 12.02. 16:50
Loading EURUSD prices.. 4500 min
Read trade stats from disk

Trade: dt-e9-htc-30min EURUSD 12.02.2014
[EURUSD::L3306] continuing
Read dt-e9-htc-30min.fac dt-e9-htc-30min.par
Saved trade stats to disk
Asset=EURUSD; direction=1; OptimalF=0.451000;
Margin=211.950000; Lots=0
[Wed 12.02. 16:50] 964 +0 -6 \


THANKS! I'm demoing this now, I want to see it behave correctly over several live trades.

Re: Save trade stats between Zorro restarts [Re: dusktrader] #437237
02/12/14 17:04
02/12/14 17:04
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
That brings up another point... something I had in mind that I need to research further (I don't yet know how to do it in C) --

on the asset loop, I would like to use one global loop. I think what I want to do is setup an array of assets inside the run() function, and then just use a pointer to that array in my sub-functions to recurse through. That would be ideal I think (rather than having 3 separate asset loops).

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