Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by 7th_zorro. 04/20/24 07:29
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, henrybane, flink, Edgar_Herrera), 758 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
frameSync() in multi-asset/algo scripts and PlusDI #482809
04/01/21 07:59
04/01/21 07:59
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
This example script:
Code
 function run()
{
		
	set(LOGFILE);		
	
	BarPeriod = 60; 		
		
	LookBack = 1500; 		
	
   int iTF=1;
	
	while(asset(loop("AUD/CHF","EUR/JPY")))  
	{
			int tf = (Itor1*2)+2 ;  // i.e.2 for AUD/CHF or 4 - for EUR/JPY, potentially - optimized
			TimeFrame = frameSync(tf);			
						
			iTF=TimeFrame;			
			
			TimeFrame=1; //
			vars dH = series(priceHigh(0),50);
			vars dL = series(priceLow(0),50);
			vars dO = series(priceOpen(0),50);
			vars dC = series(priceClose(0),50);			  
			
			vars dmiP = series(PlusDI(dO,dH,dL,dC,15),5);  
			
			watch("Asset=", Asset," TF=", iTF, " dmiP=", dmiP[0]);
	}

}
produces this output:
Quote
[4: Thu 20-01-02 12:00] (0.678160)
Asset= AUD/CHF TF= -1 dmiP= 100.00
Asset= EUR/JPY TF= -1 dmiP= 0.00000
[5: Thu 20-01-02 13:00] (0.678970)
Asset= AUD/CHF TF= 0 dmiP= 100.00
Asset= EUR/JPY TF= 0 dmiP= 0.00000
[6: Thu 20-01-02 14:00] (0.678880)
Asset= AUD/CHF TF= -1 dmiP= 100.00
Asset= EUR/JPY TF= 0 dmiP= 0.00000
[7: Thu 20-01-02 15:00] (0.679070)
Asset= AUD/CHF TF= 0 dmiP= 100.00
Asset= EUR/JPY TF= 0 dmiP= 0.00000
[8: Thu 20-01-02 16:00] (0.678640)
Asset= AUD/CHF TF= -1 dmiP= 100.00
Asset= EUR/JPY TF= -1 dmiP= 0.00000 // should be -3 for EUR/JPY
. So, frameSync doesn't seem to work correctly in a multi-asset/algo setup.

Also, PlusDI/MinusDI variants of the functions explicitly accepting 4 price series also do not work. This is unrelated to timeframes or frameSync; when TimeFrame-related code is commented out, these functions still return gibberish.

Re: frameSync() in multi-asset/algo scripts and PlusDI [Re: Zheka] #482825
04/02/21 12:15
04/02/21 12:15
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
Hmm, from how I understand the manual the purpose of framesync is syncronizing to 1, 4, or 24 hours. So 1, 4, or 24 bars are ok, but not (Itor1*2)+2. The 50 in your series is likely also wrong because PlusDI is an accumulative indicator.

Re: frameSync() in multi-asset/algo scripts and PlusDI [Re: Zheka] #482828
04/02/21 14:19
04/02/21 14:19
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
Yes, indeed, other values besides 1 or 4 do not work correctly. As a feature request then, can framesync() be made to work correctly for any divisor of 24?

PlusDI() being "accumulative" indicator, it uses only 1 past value of itself in the calculation of the next, right? So, an input series of length 50 should be more than enough (even if a simple average is used in the initial calc)...

Why would it work for an input series length of 54+?

Is it influenced by UnstablePeriod=40? But UnstablePeriod "strips off initial values from the indicator", not inputs....Ignoring it will lead to "meaningfully incorrect" indicator values, but should not influence the output of the indicator function per se...

Also, "Cumulative indicators that use series - such as LowPass, DominantPeriod, UO, etc. - use LookBack as unstable period" (which is set to 1500 in my script above).


So, how does it work and what are the rules?

Last edited by Zheka; 04/02/21 14:22.
Re: frameSync() in multi-asset/algo scripts and PlusDI [Re: Zheka] #482843
04/06/21 15:58
04/06/21 15:58
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
In your case the indicator needs to look back 55 bars: Timeperiod 15 plus Unstableperiod 40. Indicators with internal series like Lowpass need no unstable period.

For being on the safe side, don't give a series length unless you are sure what you need. The default length will always work.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1