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
2 registered members (AndrewAMD, Imhotep), 567 guests, and 4 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 1 of 2 1 2
EXITRUN only in simulations? #473336
06/29/18 15:21
06/29/18 15:21
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Trying to collect some information while trading and saving them after finishing the strategy, mostly done by pressing the Stop button. I thought this could be done in a for(all_trades) loop in EXITRUN but surprisingly this does not work.
Quote:
EXITRUN
Last run of the simulation. All trades are closed. [...]

Really only in simulations? Is there any function to use in live trading?

Re: EXITRUN only in simulations? [Re: Sphin] #473341
06/30/18 01:52
06/30/18 01:52
Joined: Sep 2017
Posts: 235
H
Hredot Offline
Member
Hredot  Offline
Member
H

Joined: Sep 2017
Posts: 235
If you know how long trading sessions take, you could use dataNew, dataAppendRow, dataSet and e.g. in half an hour intervals dataSave. Then roughly note the session start time and make sure to hit Stop only after the last half an hour has been dumped.

Re: EXITRUN only in simulations? [Re: Hredot] #473345
06/30/18 11:21
06/30/18 11:21
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Thanks, but the for(all_trades) loop itself is okay, my intention was more finding a trigger to execute it if trading of the strategy is stopped.

Re: EXITRUN only in simulations? [Re: Sphin] #473349
06/30/18 12:17
06/30/18 12:17
Joined: Sep 2017
Posts: 235
H
Hredot Offline
Member
Hredot  Offline
Member
H

Joined: Sep 2017
Posts: 235
I see, here is a hacky way:

Code:
...
if(file_date("your\path\stop.txt")>0){
    ... save data here ...
}
...



Create stop.txt shortly before stopping the script, and delete it right after.

Re: EXITRUN only in simulations? [Re: Hredot] #473351
06/30/18 16:35
06/30/18 16:35
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Quick and dirty, I use a lot of such solutions!

Quote:
Create stop.txt shortly before stopping the script, and delete it right after.

Hmm ... but instead of creating the stop.txt shortly before stopping the script I could also execute the for(all_trades) loop - if I only knew when the time is "shortly before stopping the script" but this is the time in question.

Re: EXITRUN only in simulations? [Re: Sphin] #473352
06/30/18 17:26
06/30/18 17:26
Joined: Sep 2017
Posts: 235
H
Hredot Offline
Member
Hredot  Offline
Member
H

Joined: Sep 2017
Posts: 235
Simplest solution would be of course, if you know exactly how long and at what hours of day the trading session starts and ends. Then you could execute the for(all_trades) loop e.g. exactly at market close time and just make sure to hit Stop a minute or two later.

Re: EXITRUN only in simulations? [Re: Hredot] #473353
06/30/18 18:50
06/30/18 18:50
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Simplest solution would be an 'onStop event handler' or making EXITRUN available also in trade mode. The evaluate (PERFORMANCE* perf) would be a possible workaround but in trade mode it is executed when the status page is updated, only in test mode at the end of a test or when Result is clicked. An onResultClick event in trade mode was also a viable way ...

Re: EXITRUN only in simulations? [Re: Sphin] #473355
06/30/18 19:12
06/30/18 19:12
Joined: Sep 2017
Posts: 235
H
Hredot Offline
Member
Hredot  Offline
Member
H

Joined: Sep 2017
Posts: 235
I agree, ideally they should implement this in Zorro so people don't have to do ritual dances around it to get it to work.

Re: EXITRUN only in simulations? [Re: Hredot] #473360
07/01/18 13:33
07/01/18 13:33
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
I hope they dont, because when I hit stop I want it to stop, not to start another run. There must be a better solution.

Re: EXITRUN only in simulations? [Re: Petra] #473361
07/01/18 13:44
07/01/18 13:44
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Why start another run? if(is(EXITRUN)) is a trigger to execute some commands after the simulation. My intention is to make it or any substitute available not only in test but also in trade mode. It has nothing to do with restarting the run.

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1