In MQL4 in the following code, how can I have if buy swap is negative, be red in ()

 

I am trying to get this when the swap is a negative number it will show up as red in ( )


How can I do that with the follow code


  ObjectCreate("spread/swap monitor3", OBJ_LABEL, ("spread/swap monitor ("+Symbol()+")"), 0, 0);
   ObjectSetText("spread/swap monitor3","Buy Swap :", 12, "Arial Black", Blue);
   ObjectSet("spread/swap monitor3", OBJPROP_CORNER, 3);
   ObjectSet("spread/swap monitor3", OBJPROP_XDISTANCE, swaplong_distance_r);
   ObjectSet("spread/swap monitor3", OBJPROP_YDISTANCE, swaplong_distance_s);
//----
   ObjectCreate("spread/swap monitor4", OBJ_LABEL, ("spread/swap monitor ("+Symbol()+")"), 0, 0);
   ObjectSetText("spread/swap monitor4",DoubleToStr( swaplong ,2),12, "Arial Black",Blue);        // I would like this to be red rather than blue if swap number is negative. //



   ObjectSet("spread/swap monitor4", OBJPROP_CORNER, 3);
   ObjectSet("spread/swap monitor4", OBJPROP_XDISTANCE, swaplong_distance_p);
   ObjectSet("spread/swap monitor4", OBJPROP_YDISTANCE, swaplong_distance_q);



Thanks
  

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
When a graphical object is created using the ObjectCreate() function, it's necessary to specify the type of object being created, which can be one of the values of the ENUM_OBJECT enumeration. Further specifications of object properties are possible using functions for working with graphical objects.
 
M-33:

I am trying to get this when the swap is a negative number it will show up as red in ( )


How can I do that with the follow code


  ObjectCreate("spread/swap monitor3", OBJ_LABEL, ("spread/swap monitor ("+Symbol()+")"), 0, 0);
   ObjectSetText("spread/swap monitor3","Buy Swap :", 12, "Arial Black", Blue);
   ObjectSet("spread/swap monitor3", OBJPROP_CORNER, 3);
   ObjectSet("spread/swap monitor3", OBJPROP_XDISTANCE, swaplong_distance_r);
   ObjectSet("spread/swap monitor3", OBJPROP_YDISTANCE, swaplong_distance_s);
//----
   ObjectCreate("spread/swap monitor4", OBJ_LABEL, ("spread/swap monitor ("+Symbol()+")"), 0, 0);
   ObjectSetText("spread/swap monitor4",DoubleToStr( swaplong ,2),12, "Arial Black",Blue);
   ObjectSet("spread/swap monitor4", OBJPROP_CORNER, 3);
   ObjectSet("spread/swap monitor4", OBJPROP_XDISTANCE, swaplong_distance_p);
   ObjectSet("spread/swap monitor4", OBJPROP_YDISTANCE, swaplong_distance_q);



Thanks
  

Use Alt+S when posting code! attach

Reason: