Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 17,605 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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,022
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,022
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