Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Petra, AndrewAMD, VoroneTZ, 2 invisible), 822 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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