Declare TWO plots - a blank can be easily created using the 'MQL Wizard'
//+------------------------------------------------------------------+ //| Indicator 1.mq5 | //| Copyright 2021, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2021, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #property indicator_chart_window #property indicator_buffers 2 #property indicator_plots 2 //--- plot HMA_Fast #property indicator_label1 "HMA_Fast" #property indicator_type1 DRAW_LINE #property indicator_color1 clrLime #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot HMA_Slow #property indicator_label2 "HMA_Slow" #property indicator_type2 DRAW_LINE #property indicator_color2 clrRed #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- input parameters input int Input1=9; //--- indicator buffers double HMA_FastBuffer[]; double HMA_SlowBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,HMA_FastBuffer,INDICATOR_DATA); SetIndexBuffer(1,HMA_SlowBuffer,INDICATOR_DATA); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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[]) { //--- //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
For appearance I want what is shown in the attached image but it doesn't work now.
Perform calculations in 'OnCalculate' and fill two indicator buffers. As a result, you will receive two lines of the indicator.
Thank you so much for your help so far and I am very grateful for it.
I want to solve this: I have one piece of HMA and I want to create the two colors with separate buffers.
See the attacheb the picture
Thank you.
For appearance I want what is shown in the attached image but it doesn't work now.
Regardless if you are using mt4 or mt5, if you decide to draw color line the way you are trying to do, and you use only 2 buffers, it will repaint
Frankly, when all it takes is to read the state of the color buffer to see the state of some colored line (and I mean not just 2 colors and all that using just 2 buffers : one drawing buffer and one color index buffer) trying to do what you are trying to do (what we were forced to do in mt4) is a waste of time
The HMA colors should be separate so I can examine them.
This would be perfect, for example, but written in mql4 and not in mql5.
IT IS FORBIDDEN TO DISCUSS MARKET PRODUCTS ON THE FORUM !!!

- 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 attached image shows what I want. Can anyone help me with this?
Sorry for the stupid question. I just started learning mql5
Thanks in advance to everyone