Please use this . . . it makes it easier to read

Ticket is a bool . . . how can this be correct ?
if(ticket>=0) Print("An order has been successfully placed with ticket # ",ticket,"."); // request is completed or order is placed if(ticket<0)
From here: https://docs.mql4.com/basis/types/bool
"Boolean constants may have the value of true or false, numeric representation of them is 1 or 0, respectively. True or TRUE, False or FALSE can be used, as well."
Ticket can never be less than 0
What type is TicketModify ? is it a bool ?
Hello:
I have this in my code:
// Returns result and error messages
void PrintMessageOrderModify (bool ticket) {
int check;
check=GetLastError();
if(ticket>=0) Print("An order has been successfully placed with ticket # ",ticket,"."); // request is completed or order is placed
if(ticket<0)
if(ticket) Print("An order has been successfully placed with ticket # ",ticket,"."); // request is completed or order is placed
if(!ticket)
etc
but then I get no messages at all.
Any ideas?
Thanks
bool OrderModify( int ticket, double price, double stoploss, double takeprofit, datetime expiration, color arrow_color=CLR_NONE)You seem to be using the result of OrderModify as an INT (in fact as a ticket) when it is actually a bool.
You seem to be using the result of OrderModify as an INT (in fact as a ticket) when it is actually a bool.
I made a few changes, I think it's working.
Thanks
Ticket is a bool . . . how can this be correct ?
From here: https://docs.mql4.com/basis/types/bool
"Boolean constants may have the value of true or false, numeric representation of them is 1 or 0, respectively. True or TRUE, False or FALSE can be used, as well."
Ticket can never be less than 0
What type is TicketModify ? is it a bool ?
Yes, it's a bool.
I did:
if(ticket>0) Print("An order has been successfully placed with ticket # ",ticket,"."); // request is completed or order is placed
if(ticket<=0)
switch(check) {
etc.
and it's working.
I'll do:
if(ticket>0) Print("An order has been successfully placed with ticket # ",ticket,"."); // request is completed or order is placed
if(ticket=0)
switch(check) {
etc.
it should work as well.
If it's a bool do it properly . .
if(ticket) Print("An order has been successfully placed with ticket # ",ticket,"."); // request is completed or order is placed if(!ticket)
if that doesn't work then there is something wrong somewhere else.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello:
I have this in my code:
// Returns result and error messages
void PrintMessageOrderModify (bool ticket) {
int check;
check=GetLastError();
if(ticket>=0) Print("An order has been successfully placed with ticket # ",ticket,"."); // request is completed or order is placed
if(ticket<0)
switch(check) {
case 2: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_COMMON_ERROR"); break; //
case 3: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_INVALID_TRADE_PARAMETERS"); break; //
case 4: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_SERVER_BUSY"); break; //
case 6: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_NO_CONNECTION"); break; //
case 9: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_MALFUNCTIONAL_TRADE"); break; //
case 128: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_TRADE_TIMEOUT"); break; //
case 129: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_INVALID_PRICE"); break; //
case 130: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_INVALID_STOPS"); break; //
case 131: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_INVALID_TRADE_VOLUME"); break; //
case 133: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_TRADE_DISABLED"); break; //
case 134: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_NOT_ENOUGH_MONEY"); break; //
case 135: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_PRICE_CHANGED"); break; //
case 136: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_OFF_QUOTES"); break; //
case 137: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_BROKER_BUSY"); break; //
case 138: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_REQUOTE"); break; //
case 139: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_TRADE_MODIFY_DENIED"); break; //
case 146: Print("TradeLog: Trade request failed. Error: ",check, ". Description: ERR_TRADE_CONTEXT_BUSY"); break; //
default: Print("Other error: ", check); // Some other reason, output the server response code
}
}
and then this:
TicketModify = OrderModify(OrderTicket(),Order_OpenPrice,PossibleStop,0,0,Violet); // Order modify
PrintMessageOrderModify(TicketModify);
The problem is that when the StopLoss doesn't move because price hasn't moved enough, I should be getting the error message INVALID STOPS, and instead I'm always getting "An order has been successfully placed with ticket # "0.", (I can see also on the screen that the SL hasn't moved).
I tried
if(ticket) Print("An order has been successfully placed with ticket # ",ticket,"."); // request is completed or order is placed
if(!ticket)
etc
but then I get no messages at all.
Any ideas?
Thanks