Gamestudio Links
Zorro Links
Newest Posts
Camera always moves upwards?
by clonman. 11/13/25 14:04
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
Training with the R bridge does not work
by frutza. 11/05/25 00:46
Zorro 2.70
by opm. 10/24/25 03:44
Alpaca Plugin v1.4.0
by TipmyPip. 10/20/25 18:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 21,112 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sheliepaley, Blueguy, blobplayintennis, someone2, NotEBspark
19177 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
running an asset loop in tock #485777
04/20/22 18:49
04/20/22 18:49
Joined: Aug 2017
Posts: 311
Netherlands
G
Grant Offline OP
Senior Member
Grant  Offline OP
Senior Member
G

Joined: Aug 2017
Posts: 311
Netherlands
As a general remark about the use of tick() / tock() functions, the manual states:

Quote
Trading with different assets in a tick function can cause backtest snooping bias. When historical price ticks for assets A and B have the same time stamps, the tick function will first run with asset A, then with asset B. In the first run, asset A has the current price, but asset B still the previous price. This can be used to snoop the next B price especially when it strongly depends on the A price. To prevent this effect, use the tock function for trading multiple assets when required, and set TockTime to the tick resolution of the used historical data, or to TickTime in live trading.


However, I'm not allowed to run an asset loop in tock(). This results in an error:

Quote
Error 041: series/loops defined outside run!


It's not a big deal for me to work around this, but can this limitation be removed or is there a particular reason for this?

Thank you.

Re: running an asset loop in tock [Re: Grant] #485781
04/21/22 08:02
04/21/22 08:02
Joined: Jul 2000
Posts: 28,029
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,029
Frankfurt
That's no limitation, but just a code error. Zorro detected that you called series() or loop() in a wrong way or at a wrong place. You can run as many asset loops in tock() as you want, but the special loop() function is used for component optimizing, and that makes no sense inside tock().

https://zorro-project.com/manual/en/loop.htm

Re: running an asset loop in tock [Re: Grant] #485788
04/21/22 15:04
04/21/22 15:04
Joined: Aug 2017
Posts: 311
Netherlands
G
Grant Offline OP
Senior Member
Grant  Offline OP
Senior Member
G

Joined: Aug 2017
Posts: 311
Netherlands
Thank you for the clarification, JCL.

Being a creature of habits, I've always used an asset loop for asset calls, but I see that a 'for(used_assets)' works nicely in tock().


Moderated by  Petra 

Gamestudio download | 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