Download MetaTrader 5

How can I transfer a Color into a function ?

To add comments, please log in or register
Achim Rogalski
61
Achim Rogalski  

I want draw different colors for different Situations.

Example:

if(MACD_Value == 100.0)

  {   string Col = "Green";  Order_Close(Col); }

if(MACD_Value == 0.0)

{ string Col = "Red"; Order_Close(Col); } 

 

 

--------------------------------------------------------------------------

// Functions:

void Order_Close( string Col)

{ bool OrdClose = OrderClose(OrderTicket(),1.0,Bid,1.0,Col); }

 

Result: Mistake  implicit Conversion from string to number.

How is the correct Code under MQL 4 ? 

Keith Watford
Moderator
10614
Keith Watford  
 color Col = clrGreen;

//-----
void Order_Close( color Col) 
You don't set colour with a string
Achim Rogalski
61
Achim Rogalski  

Thank you, GumRai. That was a good advice.

Greetings from Germany, Hamburg.

To add comments, please log in or register