how can change color for indicator line & an object and they must have same color ?

 

hi

i want to have same color for indicator line and the object refer to it. so if color of indicator line have been changed in " colors" tab of indicator , i want to change color for object automatically as same as that.

here is my code, as you see:

.
.
.
#property indicator_label1  "EUR"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrBlue
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
...
.
.
int OnCalculate(...........
{
.
.
.
SetLabel("row_cu_EUR_name",CURRENCY_NAMES[1],clrBlue,10,10); // indicator_color1    clrBlue
.
.
.
return(rates_total);
}
//----------------------------------------------------------------------------------------------------------//
void SetLabel(string name,string _text,color _color,int xd,int yd,int fs=8,string font="Arial")
             {
              if(ObjectFind(0,name)>=0) ObjectDelete(0,name);
              if (ObjectFind(0,name)<0) ObjectCreate(0,name,OBJ_LABEL,ChartWindowFind(0,short_name),0,0);
              ObjectSetString(0,name,OBJPROP_TEXT,_text);
              ObjectSetInteger(0,name,OBJPROP_COLOR,_color);
              ObjectSetInteger(0,name,OBJPROP_XDISTANCE,xd);
              ObjectSetInteger(0,name,OBJPROP_YDISTANCE,yd);
              ObjectSetInteger(0,name,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
              ObjectSetInteger(0,name,OBJPROP_ANCHOR,ANCHOR_RIGHT_UPPER);
              ObjectSetInteger(0,name,OBJPROP_FONTSIZE,fs);
              ObjectSetString(0,name,OBJPROP_FONT,font);
             }
//----------------------------------------------------------------------------------------------------------//

when i change it as below there is no warning or errer, but it does not work.

SetLabel("row_cu_EUR_name",CURRENCY_NAMES[1],indicator_color1,10,10); // indicator_color1    clrBlue

do you have any idea.

thanks in advance.

 

https://www.mql5.com/en/docs/customind/propertiesandfunctions

Documentation on MQL5: Custom Indicators / Connection between Indicator Properties and Functions
Documentation on MQL5: Custom Indicators / Connection between Indicator Properties and Functions
  • www.mql5.com
Custom Indicators / Connection between Indicator Properties and Functions - Reference on algorithmic/automated trading language for MetaTrader 5
 
angevoyageur:

https://www.mql5.com/en/docs/customind/propertiesandfunctions

thank you to reply,

but i asked ; when color of indicator changed manually by " colors " tab, then our object must get that color,

thank for link , but all about indicator color, did i missed some thing ?

 
TIMisthebest:

thank you to reply,

but i asked ; when color of indicator changed manually by " colors " tab, then our object must get that color,

thank for link , but all about indicator color, did i missed some thing ?

Yes.

https://www.mql5.com/en/docs/customind/plotindexgetinteger

Documentation on MQL5: Custom Indicators / PlotIndexGetInteger
Documentation on MQL5: Custom Indicators / PlotIndexGetInteger
  • www.mql5.com
Custom Indicators / PlotIndexGetInteger - Reference on algorithmic/automated trading language for MetaTrader 5
 
angevoyageur:

Yes.

https://www.mql5.com/en/docs/customind/plotindexgetinteger

thank you.

Its done.