Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
- Usually people who can't code don't receive free help on this forum.
- If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
- To learn MQL programming, you can research the many available Articles on the subject, or examples in the Codebase, as well as reference the online Book and Documentation
- Remember also, that you can debug your code with MetaEditor's own debugging functionality.
- If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free). However, recommendations or suggestions for Market products are not allowed on the forum, so you will have to do your own research.
- Finally, you also have the option to hire a programmer in the Freelance section.
#property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 clrYellow #property indicator_width1 1 double Buffer1[]; int OnInit() { SetIndexBuffer(0,Buffer1,INDICATOR_DATA); return(INIT_SUCCEEDED); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { if (prev_calculated>=0) ArrayCopy(Buffer1, close, prev_calculated, prev_calculated, rates_total); return(rates_total - 1); }
Thank you very much.
So, in general when I want to display something like this on chart, it is better to write a custom indicator and use iCustom() function to call it?
Sorry for these kinds of questions. I come from pine script and it seems that mql5 and Pine script are conceptually different.
Just use CopyClose and set it as series. Easiest approach
iCustom can slow down the EA in the strategy tester significantly
Thank you very much.
So, in general when I want to display something like this on chart, it is better to write a custom indicator and use iCustom() function to call it?
Sorry for these kinds of questions. I come from pine script and it seems that mql5 and Pine script are conceptually different.
it is normally done in an ea, however, there is a few threads/discussions on the forum with general agreement that using sourcing from an indicator is better. The reasons it is "better" are rather unclear -- at leas imo.
Just use CopyClose and set it as series. Easiest approach
iCustom can slow down the EA in the strategy tester significantly
it is normally done in an ea, however, there is a few threads/discussions on the forum with general agreement that using sourcing from an indicator is better. The reasons it is "better" are rather unclear -- at leas imo.
Thanks
Just use CopyClose and set it as series. Easiest approach
iCustom can slow down the EA in the strategy tester significantly
Thanks. Ok. But with this approach I can not plot close on the chart. So I think I have to use iCustom function.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In Pine script, it is:
In mql5 I can use something like this, but it creates numerous parallel lines.