Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 03/28/26 14:01
TMFs on options in live trading
by Spirit. 03/26/26 19:52
TDAmeritrade plugin with new Schwab accountt?
by AndrewAMD. 03/24/26 17:11
Black Book, 4th edition
by jcl. 03/17/26 09:28
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (Quad, TipmyPip, James168), 7,328 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
mredit, vestriaa, Lukudo, mldenoiser, the1
19204 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,090
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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