Why these color codes are not working ?.

 

I used this color codes as input parameters. The I used them to modify object colors. but it does not work. I checked the EAs input menu, all the colors are pre-selected to black. even though correctly declared them. 

input color Monthly_Resistance = clrCrimson;
input color Monthly_Support = clrSeaGreen;
input color Weekly_Resistance = clrOrangeRed;
input color Weekly_Support = clrForestGreen;
input color Daily_Resistance =clrTomato;
input color Daily_Support= clrSpringGreen;
input color H4_Resistance = clrIndianRed;
input color H4_Support = clrMediumSeaGreen;
input color H1_Resistance = clrBrown;
input color H1_Support = clrLightSeaGreen;




  if(ChartPeriod(0) == PERIOD_M15) // H1 Pivot Levels
     {

      Draw_Lines("H1_R1",Time1H,H1_R1,TimeEnd_Month,H1_R1,H1_Resistance,"H1_R1",OBJ_PERIOD_M15);
      Draw_Lines("H1_R2",Time1H,H1_R2,TimeEnd_Month,H1_R2,H1_Resistance,"H1_R2",OBJ_PERIOD_M15);
      Draw_Lines("H1_R3",Time1H,H1_R3,TimeEnd_Month,H1_R3,H1_Resistance,"H1_R3",OBJ_PERIOD_M15);
      Draw_Lines("H1_S1",Time1H,H1_S1,TimeEnd_Month,H1_S1,H1_Support,"H1_S1",OBJ_PERIOD_M15);
      Draw_Lines("H1_S2",Time1H,H1_S2,TimeEnd_Month,H1_S2,H1_Support,"H1_S2",OBJ_PERIOD_M15);
      Draw_Lines("H1_S3",Time1H,H1_S3,TimeEnd_Month,H1_S3,H1_Support,"H1_S3",OBJ_PERIOD_M15);
      DrawBaseLine("H1_Base",Time1H,Pivot_Price_H1,TimeEnd_Month,Pivot_Price_H1,clrWhite,"H1_Base",OBJ_PERIOD_M15);
      
     }
  }
//+------------------------------------------------------------------+
//| Expert Object Function -- 00 --  Draw Vertiacl Line              |
//+------------------------------------------------------------------+
void Draw_Lines(string ObjName,datetime Time1, double price1, datetime Time2,
                double price2, color clr, string label, long TimeFrame = OBJPROP_TIMEFRAMES)
  {
   ObjectDelete(0,ObjName);
   ObjectCreate(0,ObjName,OBJ_TREND,0,Time1,price1,Time2,price2); // Horizonal Ray Line with times
   ObjectSetInteger(0,ObjName, OBJPROP_COLOR, clr);
   ObjectSetInteger(0, ObjName, OBJPROP_WIDTH, 1);
   ObjectSetInteger(0, ObjName, OBJPROP_BACK,1);
   //ObjectSetInteger(0,ObjName,OBJPROP_COLOR,clrAliceBlue);
   ObjectSetString(0,ObjName,OBJPROP_TEXT,label);
   ObjectSetInteger(0,ObjName,OBJPROP_TIMEFRAMES,TimeFrame);
  }


Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Properties
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Properties
  • www.mql5.com
Graphical objects can have various properties depending on the object type. Values of object properties are set up and received by corresponding...
 
Hapu Arachchilage Tharindu Lakmal:

I used this color codes as input parameters. The I used them to modify object colors. but it does not work. I checked the EAs input menu, all the colors are pre-selected to black. even though correctly declared them. 


your code can not be compiled. Fix the errors and post again. 

 
Arpit T #:

your code can not be compiled. Fix the errors and post again. 

It's fixed... code working.. I think it's an error from meta trader

 

may be working for you but not for me, post something which can be compiled


 
Hapu Arachchilage Tharindu Lakmal #:

It's fixed... code working.. I think it's an error from meta trader

Then post the fixed code
 

Hi

Please send the full code – there is something else which changes the colors of the inputs. Normally if you would use standard inputs, it won’t be changed.

Or maybe you have some preset applied to this script by default which changes the values – it seems like there would be some wrong template applied here by default. 

Best Regards

 
Marzena Maria Szmit #:

Hi

Please send the full code – there is something else which changes the colors of the inputs. Normally if you would use standard inputs, it won’t be changed.

Or maybe you have some preset applied to this script by default which changes the values – it seems like there would be some wrong template applied here by default. 

Best Regards

There wasn't any issue with the code brother... yes, maybe you see an issue just because I posted it wrong way. my bad. the inputs were outside the event handlers and the if statements were inside the OnTick handler. There was an issue from the meta trader. I simply closed the meta trader and reopened it. that all I did.  Then it started to work as the way it supposed to. no errors so far from that time.   I didn't change any lines of the codes. for me that issue was not in the code script.  could be a stuck or Unkown error... may be. How ever there wasn't any issue in the code script. 

sorry brother, that was a project for a customer. so, I think it's not correct to post the full code. I successfully completed the job. the bug has fixed.