who can tell, we need to c the ZigZag2_r_ indicator to answer
The Link to the indicator can be found in my first post and now again here. https://www.mql5.com/en/code/7762
Hi there,
i am fairly new to writing EAs, so i wanted to start of small and let the EA grow over the time. At the moment i am stuck with exporting values from the ZigZag2_R_ indicator to my EA. As stated on the page of the indicator ( https://www.mql5.com/en/code/7762 ) you can read out the peaks and bottoms with the following code:
When i use it this way, i get an error that index is not defined, which makes sense. But i delete the index or replace it with any number the EA compiles fine, but as output i only get "0".
I debug the thing by just printing the output of the variable in MetaTrader by using the following code: (Yes the variable ZZ_high and ZZ_low are initialized at the top and the following code is excuted bellow start(), just to avoid misunderstandings)
Can anyone please tell me where my mistake is and how to get the last peak and bottom as output?
u need to find the right candle where the ZigZag_r_ is located, it's not always on bar[0] so, u have to find the right bar
b.t.w it's impossible that ZigzagPeakBuffer & ZigzagLawnBuffer to be on one same bar
int n, i = 0; while(n<6) { if(p0>0) {p5=p4; p4=p3; p3=p2; p2=p1; p1=p0; } p0=iCustom(Symbol(),0,"zigzag",ExtDepth,ExtDeviation,ExtBackstep,0,i); if(p0>0) {n+=1; } i++; }
I use that loop for calling zigzag (found it somewhere in the forum).
p4 to p1 are the last highs / lows. That works fine :)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there,
i am fairly new to writing EAs, so i wanted to start of small and let the EA grow over the time. At the moment i am stuck with exporting values from the ZigZag2_R_ indicator to my EA. As stated on the page of the indicator ( https://www.mql5.com/en/code/7762 ) you can read out the peaks and bottoms with the following code:
When i use it this way, i get an error that index is not defined, which makes sense. But i delete the index or replace it with any number the EA compiles fine, but as output i only get "0".
I debug the thing by just printing the output of the variable in MetaTrader by using the following code: (Yes the variable ZZ_high and ZZ_low are initialized at the top and the following code is excuted bellow start(), just to avoid misunderstandings)
Can anyone please tell me where my mistake is and how to get the last peak and bottom as output?
Thanks in advance.
Greetings Adrian