Unable to change color and style of Horizontal Lines

 

Hi All,

I am trying to change the properties of a Horizontal LIne I have created. I would like to change both color (To Green) and style (To DashDot) of the line and I am using the code below.

However the line that appears is still red and the style is "solid", which appears to be MT4 default.

Are there any mistakes in my code?

Thanks,

MG 


   double gm_price_low=MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_ASK)*SL_Perc/100;


   bool SL_Support_Line=ObjectCreate(0,"SupportLine", OBJ_HLINE, 0, 0,gm_price_low);

   ObjectSetInteger(0,SL_Support_Line,OBJPROP_COLOR,clrGreen);

   ObjectSetInteger(0,SL_Support_Line,OBJPROP_STYLE,STYLE_DASHDOT);

 
MacGiamma:

Hi All,

I am trying to change the properties of a Horizontal LIne I have created. I would like to change both color (To Green) and style (To DashDot) of the line and I am using the code below.

However the line that appears is still red and the style is "solid", which appears to be MT4 default.

Are there any mistakes in my code?

Yes.

   bool SL_Support_Line=ObjectCreate(0,"SupportLine", OBJ_HLINE, 0, 0,gm_price_low);
   if (SL_Support_Line)
   {
      ObjectSetInteger(0,"SupportLine",OBJPROP_COLOR,clrGreen);
      ObjectSetInteger(0,"SupportLine",OBJPROP_STYLE,STYLE_DASHDOT);
   }
 
It works thanks for the easy fix!!!