Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (dr_panther, Ayumi, 7th_zorro), 877 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Doubt on accesing indicator previous values!! Anyone can help? #468857
10/23/17 19:05
10/23/17 19:05
Joined: Oct 2017
Posts: 10
O
Oligon Offline OP
Newbie
Oligon  Offline OP
Newbie
O

Joined: Oct 2017
Posts: 10
Hello everyone!

I'm very excited to try Zorro, however I'm having some trouble to figure out how can I access previous values of the ZigZag indicator. For example if I want to get the rPeak value but 2 values before the current value, how would I approach it? I know rPeak is a global var type, but how can I access for example rPeak(2)?

Thanks so much in advance for anyone that could point me in the right direction!!

Re: Doubt on accesing indicator previous values!! Anyone can help? [Re: Oligon] #468867
10/24/17 06:39
10/24/17 06:39
Joined: Feb 2017
Posts: 369
D
Dalla Offline
Senior Member
Dalla  Offline
Senior Member
D

Joined: Feb 2017
Posts: 369
Try rPeak[2]

Re: Doubt on accesing indicator previous values!! Anyone can help? [Re: Dalla] #468868
10/24/17 07:31
10/24/17 07:31
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
For getting old rPeak values, store them when a new peak appears, i.e. when rPeak becomes smaller.

Code:
static int Peak1 = 99999, Peak2, Peak3;

ZigZag(....);
if(rPeak < Peak1) {
  Peak3 = Peak2+1;
  Peak2 = Peak1+1;
  Peak1 = rPeak;
} else {
  Peak3++;
  Peak2++;
  Peak1++;
}





Re: Doubt on accesing indicator previous values!! Anyone can help? [Re: Dalla] #468874
10/24/17 20:37
10/24/17 20:37
Joined: Oct 2017
Posts: 10
O
Oligon Offline OP
Newbie
Oligon  Offline OP
Newbie
O

Joined: Oct 2017
Posts: 10
Thank you so much!!

Re: Doubt on accesing indicator previous values!! Anyone can help? [Re: jcl] #468875
10/24/17 20:37
10/24/17 20:37
Joined: Oct 2017
Posts: 10
O
Oligon Offline OP
Newbie
Oligon  Offline OP
Newbie
O

Joined: Oct 2017
Posts: 10
Thanks JCL! Will try that!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1