You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello all,
I've been looking for an answer aswell of how to get those high and low values from the ZigZag indicator. As i didn't come up with a solution, i've programed it myself, and i'm sharing it so other people that find same problem have already a solution.
First problem is that ZigZag indicator redraws, so, getting last high or low, needs a little bit of a trick.
To get other values we should add this code to your EA.
Please notice that the cycle begins with i=2, 10000 is the number of highs or lows you need, 10.000 is just an example.
The values will be saved on Array temp in wich
Position 0 saves the last high or low drawn in the chart, position 1 saves the high or low previous and so on...
for(int i=2;i<10000;i++)
{
zo=iCustom(Symbol(),PERIOD_M15,"ZigZag",0,i);
if(zo!=0) // while Zigzag does't get a higher high, or deapth, deviation , etc conditions are not yet satisfied, ZigZag indicator equals zero , so we need to filter this empty values.
{
temp[k]=zo; // highs and lows are saved in array temp[]
k++;
}
Now, to get last Wave value, you just have use current price, you comparing it to value saved in position 0,
if (Ask>temp[0]) means that last value was a low, so to get distance you just need to do last_wave=Ask-temp[0]
else means last value was a high to get distance do last_wave= temp[0]-Ask
if you don't need to know wheather it's a low or a high, and you just want the distance, then you just do last_wave= MathAbs(Ask-temp[0]) (distance always positive, right? ;) )
and that's about it, hope it helped.
good luck in your programming!
Hello all,
I've been looking for an answer aswell of how to get those high and low values from the ZigZag indicator. As i didn't come up with a solution, i've programed it myself, and i'm sharing it so other people that find same problem have already a solution.
First problem is that ZigZag indicator redraws, so, getting last high or low, needs a little bit of a trick.
To get other values we should add this code to your EA.
Please notice that the cycle begins with i=2, 10000 is the number of highs or lows you need, 10.000 is just an example.
The values will be saved on Array temp in wich
Position 0 saves the last high or low drawn in the chart, position 1 saves the high or low previous and so on...
<CODE DELETED>
Please read some other posts before posting . . .
Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
Please read some other posts before posting . . .
Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
Dear Raptor,
I did read the other posts, although it provided a solution, it was just the best for me as we are creating objects and deleting them where in my opinion and has the code shared shows, there is no need.
But if you don't find my post useful, you can always delete it, you are a moderator right? ;)
Dear Raptor,
I did read the other posts, although it provided a solution, it was just the best for me as we are creating objects and deleting them where in my opinion and has the code shared shows, there is no need.
Dear Raptor,
I did read the other posts, although it provided a solution, it was just the best for me as we are creating objects and deleting them where in my opinion and has the code shared shows, there is no need.
But if you don't find my post useful, you can always delete it, you are a moderator right? ;)
See https://www.mql5.com/en/code/10920
same as ZigZag
first buffer normal ZigZag
with last two buffers you have the highs and lows
Thank you Raptor, missed that post indeed, it even makes it easier!
Hi gjol,
please advice me how to get stochatic value from the zigzag price p0,p1,p2,p3,p4,p5 ?
what if i want to know the last three values ?
Then read on for the next two values.