Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
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), 18,619 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
Operations with series #461197
07/28/16 13:36
07/28/16 13:36
Joined: Jul 2016
Posts: 64
G
gtell Offline OP
Junior Member
gtell  Offline OP
Junior Member
G

Joined: Jul 2016
Posts: 64
Hi all,
Suppose you have the following series:

vars MA = series(SMA(Close, 21));


I want to calculate the difference with a shifted value:

MA[i] - MA[i+shift]

Where shift is a given int.
How can I do it?
Thanks

Re: Operations with series [Re: gtell] #461218
07/29/16 11:28
07/29/16 11:28
Joined: Jul 2016
Posts: 64
G
gtell Offline OP
Junior Member
gtell  Offline OP
Junior Member
G

Joined: Jul 2016
Posts: 64
I am not sure if you understand my question.
Simply, I want to calculate, for each bar, the difference with the bar which is n-times back. Where n-times is ithe value of the shift variable.
The result would be a series as well.
Could you help me or give an help?
Thanks.

PS.: May the solution be the following?

vars MAdiff = series(MA[0]-MA[shift]);


I need to test it in my laptop this night.

Last edited by gtell; 07/29/16 11:55.
Re: Operations with series [Re: gtell] #461221
07/29/16 13:31
07/29/16 13:31
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Yes, series(MA[0]-MA[shift]) will get you the difference. Make sure that Lookback is >= shift.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1