Dear developer, hope you doing well. I've started learning MQL5 a few weeks ago and I am practicing with a lot of examples. But there is something that is causing an issue and I have not identified the cause.
I have an indicator working very well:
So I am trying to add some new features to improve the code and practice with MQL5, so I have tried to colored the blue line adding some changes in the code:
When I define #property indicator_type1 DRAW_COLOR_LINE, now the indicator just plots totally wrong, like this:
The white line is not plotted anymore and the blue line was plotted with values completely different. If I change back the #property indicator_type1 to DRAW_LINE, the indicator come back working normally.
There are only two Plots, buffer 0 and buffer 1.
What am I doing wrong?
Hello , back when i started with mt5 i built an indicator with all the draw styles for understanding them .
I don't actually remember how the color lines works but maybe the source code can help you . (you are interested in all the sections gated by DRAW_COLOR_LINE)
Hello Alain, thanks. But could you explain that? I have to set the same buffer number for COLOR_INDEX? Is it right?
Hello , back when i started with mt5 i built an indicator with all the draw styles for understanding them .
I don't actually remember how the color lines works but maybe the source code can help you . (you are interested in all the sections gated by DRAW_COLOR_LINE)
Thank you so much!!!!
Hello Alain, thanks. But could you explain that? I have to set the same buffer number for COLOR_INDEX? Is it right?
COLOR_INDEX has nothing to do with the buffer index, you are confused.
The buffers for a given plot MUST BE consecutive.
SetIndexBuffer(0, bufferMASa, INDICATOR_DATA); SetIndexBuffer(1, bufferMAColors, INDICATOR_COLOR_INDEX); SetIndexBuffer(2, bufferMASa2, INDICATOR_DATA); SetIndexBuffer(3, bufferMA, INDICATOR_CALCULATIONS); SetIndexBuffer(4, bufferSignal, INDICATOR_CALCULATIONS);

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear developer, hope you doing well. I've started learning MQL5 a few weeks ago and I am practicing with a lot of examples. But there is something that is causing an issue and I have not identified the cause.
I have an indicator working very well:
So I am trying to add some new features to improve the code and practice with MQL5, so I have tried to colored the blue line adding some changes in the code:
When I define #property indicator_type1 DRAW_COLOR_LINE, now the indicator just plots totally wrong, like this:
The white line is not plotted anymore and the blue line was plotted with values completely different. If I change back the #property indicator_type1 to DRAW_LINE, the indicator come back working normally.
There are only two Plots, buffer 0 and buffer 1.
What am I doing wrong?