Hello,
I'm trying to draw an DRAW_COLOR_SECTION with sections missing or colorless.
I tried this code but it's missed.
In this bit of code:
if(color_indext==1) { ColorSectionColors[i]=NULL; }
you are basically saying:
"If the color index is 1 (clrGold), then make it NULL, which in this case becomes 0 (clrRed)."
You end up replacing one color for another color, which isn't what you want.
You could add clrBlack (or whatever your background color is) to your list of colors, then replace with that. This leaves artifacts. (See attached image.)
There is no "transparent color" that I know of, so I don't think you can do this with indexed colors.
One more time, thanks Anthony. ;-)
In this bit of code:
you are basically saying:
"If the color index is 1 (clrGold), then make it NULL, which in this case becomes 0 (clrRed)."
You end up replacing one color for another color, which isn't what you want.
You could add clrBlack (or whatever your background color is) to your list of colors, then replace with that. This leaves artifacts. (See attached image.)
There is no "transparent color" that I know of, so I don't think you can do this with indexed colors.
You can use CLR_NONE or clrNONE
You can use CLR_NONE or clrNONE
You can use CLR_NONE or clrNONE
Thanks nicholishen
OK CLR_NONE is great for DRAW_COLOR_SECTION, about the question was.
For DRAW_LINE I found something other.
I use PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0);
//+------------------------------------------------------------------+ //| lines_in_sequence.mq5 | //| Pierre Rougier | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2017, Pierre Rougier" #property link "https://www.mql5.com/en/users/pierre8r" #property version "1.00" #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 //--- the line properties is defined using the compiler directives #property indicator_label1 "Line" // indicator label (in "Data Window") #property indicator_type1 DRAW_LINE // drawing style as a line #property indicator_color1 clrMagenta // line color #property indicator_style1 STYLE_SOLID // line style #property indicator_width1 3 // line width //--- indicator buffer double LineBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- set index buffer SetIndexBuffer(0,LineBuffer,INDICATOR_DATA); PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0); //--- 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[]) { //--- int iCtr=0; //--- calculating indicator values for(int i=0;i<rates_total;i++) { iCtr++; if(iCtr<10) { LineBuffer[i]=close[i]; } else if(iCtr<20) { } else { iCtr=0; } } //--- return prev_calculated for the next call of the function return(rates_total); } //+------------------------------------------------------------------+

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I'm trying to draw an DRAW_COLOR_SECTION with sections missing or colorless.
I tried this code but it's missed.