Download MetaTrader 5

Multi-Color buffer line - Need more clarification

To add comments, please log in or register
selnomeria
254
selnomeria  

In this article - https://www.mql5.com/en/articles/135

there is not writen, how color-buffers are assigned to specific buffer.

for example:

   SetIndexBuffer(0,buffer_line1,INDICATOR_DATA);

PlotIndexSetInteger(0,PLOT_LINE_COLOR,0, clrGreen); PlotIndexSetInteger(0,PLOT_LINE_COLOR,1, clrRed);

   SetIndexBuffer(1,buffer_line2,INDICATOR_DATA);

PlotIndexSetInteger(1,PLOT_LINE_COLOR,0, clrGreen); PlotIndexSetInteger(1,PLOT_LINE_COLOR,1, clrRed);

   SetIndexBuffer(4, color_buffer,INDICATOR_COLOR_INDEX);


My question is , when we set values in the loop:


color_buffer[i] = 1;


which buffer-line color is changed?  1st or 2nd buffer?


how to refer the color-buffer to specific data-buffer?

Creating Multi-Colored Indicators in MQL5
Creating Multi-Colored Indicators in MQL5
  • 2010.08.02
  • Дмитрий Александрович
  • www.mql5.com
In this article, we will consider how to create multi-colored indicators or convert the existing ones to multi-color. MQL5 allows to represent the information in the convenient form. Now it isn't necessary to look at a dozen of charts with indicators and perform analyses of the RSI or Stochastic levels, it's better just to paint the candles with different colors depending on the values of the indicators.
Mladen Rakic
72287
Mladen Rakic  
selnomeria:

In this article - https://www.mql5.com/en/articles/135

there is not writen, how color-buffers are assigned to specific buffer.

for example:

   SetIndexBuffer(0,buffer_line1,INDICATOR_DATA);

PlotIndexSetInteger(0,PLOT_LINE_COLOR,0, clrGreen); PlotIndexSetInteger(0,PLOT_LINE_COLOR,1, clrRed);

   SetIndexBuffer(1,buffer_line2,INDICATOR_DATA);

PlotIndexSetInteger(1,PLOT_LINE_COLOR,0, clrGreen); PlotIndexSetInteger(1,PLOT_LINE_COLOR,1, clrRed);

   SetIndexBuffer(4, color_buffer,INDICATOR_COLOR_INDEX);


My question is , when we set values in the loop:


color_buffer[i] = 1;


which buffer-line color is changed?  1st or 2nd buffer?


how to refer the color-buffer to specific data-buffer?

The way you wrote it, none of your lines will be colored line

Check the link in your post

selnomeria
254
selnomeria  

I have read and that's why I have asked...  I couldnt find out with those examples...  please tell me how to do that, 

the colorbuffer-index should be the next index of the desired buffer-index???

selnomeria
254
selnomeria  

have I to add only this?


PlotIndexSetInteger(indexx,PLOT_DRAW_TYPE, DRAW_COLOR_LINE  ); 
Mladen Rakic
72287
Mladen Rakic  
selnomeria:

have I to add only this?


PlotIndexSetInteger(indexx,PLOT_DRAW_TYPE, DRAW_COLOR_LINE  ); 

Colored lines always go in pairs

Something like this

 SetIndexBuffer(0,buffer_line1,INDICATOR_DATA);
 SetIndexBuffer(1,buffer_line1colors,INDICATOR_COLOR_INDEX);
 SetIndexBuffer(2,buffer_line2,INDICATOR_DATA);
 SetIndexBuffer(3,buffer_line2colors,INDICATOR_COLOR_INDEX);


 SetIndexBuffer(nn  ,buffer_line(nn),INDICATOR_DATA);
 SetIndexBuffer(nn+1,buffer_line(nn)colors,INDICATOR_COLOR_INDEX);
You can not have one colors buffer for multiple color lines
selnomeria
254
selnomeria  
Mladen Rakic:

Colored lines always go in pairs

Something like this

You can not have one colors buffer for multiple color lines

THANKS! now i understand. THAT SHOULD BE WRITTEN IN DOCS, what you say.
Alain Verleyen
Moderator
35125
Alain Verleyen  
selnomeria:

THANKS! now i understand. THAT SHOULD BE WRITTEN IN DOCS, what you say.
Are you sure it is not ?
To add comments, please log in or register