NOTE1: you need to use designated field (Code Alt+S) to insert your code.
NOTE2: Traders and coders are coding for free:
- if it is interesting for them personally, or
- if it is interesting for many members of this forum.
Freelance section of the forum should be used in most of the cases.

- 2024.11.01
- www.mql5.com
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
This is the zigzag code for MT5, which comes with MT5 and is located in the MQL5\Indicators\Examples folder.
Compare this with the Zigzag code that comes with MT4. Especially compare places in the code like these:
// MT5 for(shift=start; shift<rates_total && !IsStopped(); shift++)
//MT4 for(i=limit; i>=0; i--)
Where am I going wrong
Hi
As was said you mixed mt4 and mt5 code and that’s why it’s not working. I don’t think all those PlotIndexSet functions work in mt4. I see that you excluded hem by adding return (INIT_SUCCEDED) before them, but why wrote them at all?
and counting in loops in for opposite direction which is probably the main reason of the problem.
Why do you use this code instead of this ZigZag which is already coded in the mt4 you can modify that original mt4 ZIgZag indicator I think it would be simpler and safer option.
Have a nice day👍📊

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
The ZigZag MQL4 code is not drawing on the chart. Where am I going wrong in using this indicator that it does not draw the ZigZag? Thank you.
The ZigZag MQL4 code is not drawing on the chart. Where am I going wrong in using this indicator that it does not draw the ZigZag? Thank you.