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
5 registered members (TipmyPip, AndrewAMD, Quad, aliswee, degenerate_762), 970 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
tock() in Test Mode #478838
12/30/19 14:07
12/30/19 14:07
Joined: Dec 2019
Posts: 53
ozgur Offline OP
Junior Member
ozgur  Offline OP
Junior Member

Joined: Dec 2019
Posts: 53
Hi,

I am testing tick() and tock() functions which both work well in Trade Mode. Tick() works in Test Mode as well however I couldn't make tock() work.

According to the manual, tock() should be triggered every bar without TICKS flag.
Quote

In [Test] or [Train] mode or in the lookback period, the tick and tock functions are normally called only once per bar. When the TICKS flag is set, the tick function is called at any new price quote in the historical data.


I modified Workshop4a.c to include tick() and tock() functions.
Logfile shows Tick() functions working but not Tock(). I can't see any errors either. How can I make tock() functional in Test Mode?

Thanks.

Code
// Indicator implementation example //////////////////////////////////
// Formula: Out[0] = (a-a^2/4) * In[0] + a^2/2 * In[1] - (a-3a^2/4) * In[2] + (2-2a) * Out[1] - (1-a)^2 * Out[2]

var lowpass(vars In,int Period)
{
	var a = 1./(1+Period);
	vars Out = series(In[0],3);
	return Out[0] = (a-0.25*a*a)*In[0]
		+ 0.5*a*a*In[1]
		- (a-0.75*a*a)*In[2]
		+ (2-2*a)*Out[1]
		- (1-a)*(1-a)*Out[2];
}

function tick()
{
	if(!is(LOOKBACK))
		print(TO_FILE," This is tick @ %s",datetime());
}

function tock()
{
	if(!is(LOOKBACK))
		print(TO_FILE," This is tock @ %s",datetime());
}

function run() // for testing
{
	set(LOGFILE,PLOTNOW); // ,TICKS
	
	Verbose = 3;
	NumYears = 1;
	
	plot("lowpass",lowpass(series(price()),10),LINE,RED);
}

Re: tock() in Test Mode [Re: ozgur] #478841
12/31/19 10:03
12/31/19 10:03
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
A tock() function makes probably not much sense in backtesting, since it is time triggered. But it works in test mode, so I can't tell how and why it does not work for you. Maybe you looked in the wrong file or something like that.

Re: tock() in Test Mode [Re: ozgur] #478847
12/31/19 14:40
12/31/19 14:40
Joined: Dec 2019
Posts: 53
ozgur Offline OP
Junior Member
ozgur  Offline OP
Junior Member

Joined: Dec 2019
Posts: 53
Hi jcl,

I tried couple of things and found a way to make it work: calling asset() in run(). Without asset(), tock() is not triggered in Test Mode. Maybe worth mentioning in the Manual.

I noticed another strange behaviour of tock() in Trade Mode, it only works after a bar close. For example, if BarMode=60 and current time is 14:38 then tock() won't be triggered another 22 minutes(+TockTime). Is this intended?

Thanks

Re: tock() in Test Mode [Re: ozgur] #478850
01/01/20 17:49
01/01/20 17:49
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
No, that's still not the reason of your problem. tock() has nothing to do with asset() or bar close, so continue testing. Of course, since tock() is time triggered, it depends on ticks, bar periods, and time settings when and how often it is triggered in the backtest.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1