Change colors from Input Variables & PlotIndexSetInteger

 

Hi ☀

I wanted to change the line color from Input Variables, but I couldn't.

I could do that with #property indicator_color1, though.

How should I do this from Input Variables and PlotIndexSetInteger(0,PLOT_LINE_COLOR,~) ?

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   1
#property indicator_type1   DRAW_COLOR_LINE
//#property indicator_color1  clrBlue,clrRed
#property indicator_width1  4

double Buffer[];
double BufferColor[];
input color InpColor1 = clrBlue;
input color InpColor2 = clrRed;

void OnInit()
  {
   SetIndexBuffer(0,Buffer,INDICATOR_DATA);
   SetIndexBuffer(1,BufferColor,INDICATOR_COLOR_INDEX);
   PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,InpColor1);
   PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,InpColor2);
   return;
  }
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
   for(int bar=0; bar<rates_total; bar++)
    {
     Buffer[bar]=price[bar];
     if(Buffer[bar]>Buffer[rates_total-1])
       BufferColor[bar]=0;
     else
       BufferColor[bar]=1;
    }
   return(rates_total);
  }
Files:
 
stitchtrader:

Hi ☀

I wanted to change the line color from Input Variables, but I couldn't.

I could do that with #property indicator_color1, though.

How should I do this from Input Variables and PlotIndexSetInteger(0,PLOT_LINE_COLOR,~) ?

#property indicator_color1  clrBlue,clrRed
#property indicator_width1  4

double Buffer[];
double BufferColor[];
input color InpColor1 = clrGreen;
input color InpColor2 = clrOrange;

void OnInit()
  {
   SetIndexBuffer(0,Buffer,INDICATOR_DATA);
   SetIndexBuffer(1,BufferColor,INDICATOR_COLOR_INDEX);
   PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,InpColor1);
   PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,InpColor2);


 
angevoyageur:


Thank you!

But I don't get it (@σ@;

#property indicator_color1

Can this not be omitted?

Please tell me the details

 

 
stitchtrader:

Thank you!

But I don't get it (@σ@;

Can this not be omitted?

Please tell me the details

 

I only uncommented this line (and change default colors). This line is mandatory.

#property indicator_color1  clrBlue,clrRed
 
angevoyageur:

I only uncommented this line (and change default colors). This line is mandatory.

Thank you! 

Reason: