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
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???
have I to add only this?
have I to add only this?
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
Colored lines always go in pairs
Something like this
You can not have one colors buffer for multiple color linesTHANKS! now i understand. THAT SHOULD BE WRITTEN IN DOCS, what you say.
THANKS! now i understand. THAT SHOULD BE WRITTEN IN DOCS, what you say.
Hello, thanks a lots
I'wited code that drow standard deviation index in multicolor (red when up, green when down) and other two indicator that drow move with different period time.
Here there a mql4 example of couple of my custom indicator (standardeviation with move and color as alert and new saratoga indicator), When i try to write standard deiation multicolored index with 2 move index
i'find a lot of matter.
I'think that mql5 manual are made only for mega expert, or simply it eritted in wrong mode!
here is a side of code in mql5. The result is no multicolor in stddev
int OnInit()
{
Hstd = iStdDev(_Symbol, _Period, SDPrd, 0, MODE_SMA, PRICE_CLOSE); // deviazione standard a SDPrd
min_rates_total = int(MathMax((SDPrd + 1), movNormale));
//--- indicator buffers mapping
SetIndexBuffer(0, STD, INDICATOR_DATA);
SetIndexBuffer(1, StdMoveCorta, INDICATOR_DATA);
SetIndexBuffer(2, StdMoveNormale, INDICATOR_DATA);
s = "Tiz Std(" + DoubleToString(SDPrd) + ")";
PlotIndexSetInteger(0, PLOT_DRAW_TYPE, DRAW_LINE);
PlotIndexSetInteger(0, PLOT_LINE_STYLE, STYLE_SOLID);
PlotIndexSetInteger(0, PLOT_LINE_COLOR, clrLime);
PlotIndexSetInteger(0, PLOT_LINE_WIDTH, 2);
PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, min_rates_total );
PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, 0.0);
PlotIndexSetString(0, PLOT_LABEL, s);
if (OKMovCorta){
s = "Tiz StdMov(" + movCorta + ")"; // metto prima l'ombra.... per favorire la visualizzazione....
PlotIndexSetInteger(1, PLOT_DRAW_TYPE, DRAW_LINE);
PlotIndexSetInteger(1, PLOT_LINE_STYLE, STYLE_DOT);
PlotIndexSetInteger(1, PLOT_LINE_COLOR, clrBlue);
PlotIndexSetInteger(1, PLOT_LINE_WIDTH, 1);
PlotIndexSetInteger(1, PLOT_DRAW_BEGIN, min_rates_total );
PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, 0.0);
PlotIndexSetString(1, PLOT_LABEL, s);
}
if (OKMovNormale){
s = "Tiz StdMov(" + movNormale + ")"; // metto prima l'ombra.... per favorire la visualizzazione....
PlotIndexSetInteger(2, PLOT_DRAW_TYPE, DRAW_LINE);
PlotIndexSetInteger(2, PLOT_LINE_STYLE, STYLE_DOT);
PlotIndexSetInteger(2, PLOT_LINE_COLOR, clrBlack);
PlotIndexSetInteger(2, PLOT_LINE_WIDTH, 1);
PlotIndexSetInteger(2, PLOT_DRAW_BEGIN, min_rates_total );
PlotIndexSetDouble(2, PLOT_EMPTY_VALUE, 0.0);
PlotIndexSetString(2, PLOT_LABEL, s);
}
SetIndexBuffer(3, StdColor, INDICATOR_COLOR_INDEX); // serve per indicare il colore fra direzione su e giu
// si devono indicare i colori dopo la dichiarazione del buffer colori
PlotIndexSetInteger(0, PLOT_COLOR_INDEXES, 2); // due colori x l'indice
PlotIndexSetInteger(0, PLOT_LINE_COLOR, 0, Up); // colore per su
PlotIndexSetInteger(0, PLOT_LINE_COLOR, 1, Down); // colore per giù
IndicatorSetInteger(INDICATOR_DIGITS, 5);
Yes, of course, in onCalculate side I put this code
// determino il colore
if ( STD[k] > STD[k-1] ) // LIME SU
StdColor[k] = 0;
else
StdColor[k] = 1;
Someone can help me ? thank you.
Here are result in mql5 (last indicator, stddev is of lime color and not in multicolor)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor
- 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 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?