MT5 real account do not set in the stoploss and takeprofit,what is the problem?

 

MT5 real account do not set in the stoploss and takeprofit,what is the problem?   demo account  set in the stoploss and takeprofit. we look at the problem,help me modify the code.Thanks.

 

bool OnOpenBuy()  
   {
    bool oob=false;
    CTrade trade;
    oob=trade.Buy(Lots,NULL,SymbolInfoDouble(Symbol(),SYMBOL_ASK),SymbolInfoDouble(Symbol(),SYMBOL_ASK)-StopLoss*_Point*10,SymbolInfoDouble(Symbol(),SYMBOL_ASK)+TakeProfit*_Point*10,"OpenBuy");
    return(oob);
    }
//+------------------------------------------------------------------+
bool OnOpenSell()
   {
    bool oos=false;
    CTrade trade;
    oos=trade.Sell(Lots,NULL,SymbolInfoDouble(Symbol(),SYMBOL_BID),SymbolInfoDouble(Symbol(),SYMBOL_BID)+StopLoss*_Point*10,SymbolInfoDouble(Symbol(),SYMBOL_ASK)-TakeProfit*_Point*10,"OpenSell");
    return(oos);
    }
//+------------------------------------------------------------------+
 
suoxinyang:

MT5 real account do not set in the stoploss and takeprofit,what is the problem?   demo account  set in the stoploss and takeprofit. we look at the problem,help me modify the code.Thanks.

 

What broker are you using?
 
figurelli:
What broker are you using?
Alpari(UK)LTD
 
suoxinyang:

MT5 real account do not set in the stoploss and takeprofit,what is the problem?   demo account  set in the stoploss and takeprofit. we look at the problem,help me modify the code.Thanks.

 

Check the execution mode
 

Right, I think this is the case too.

"Are you checking the Deal execution mode for the symbol you are trading ?  for some modes you cannot send the SL or TP with the order,  you have to send it afterwards . . ."

Another way is try pending orders, probably will work if this is the case (I do this at Alpari and works fine). 

 
Thank you very much,my english is not good , The Check the execution mode can in some more detail?  I Check the  Deal execution mode for the symbol do not know how to modify. friend can you help me modify it……
 
figurelli:

Right, I think this is the case too.

"Are you checking the Deal execution mode for the symbol you are trading ?  for some modes you cannot send the SL or TP with the order,  you have to send it afterwards . . ."

Another way is try pending orders, probably will work if this is the case (I do this at Alpari and works fine). 

Thank you very much,I know the problem,but i do not how to modify it,friend give me a lot modify code.
 
suoxinyang:
Thank you very much,my english is not good , The Check the execution mode can in some more detail?  I Check the  Deal execution mode for the symbol do not know how to modify. friend can you help me modify it……
You can find sample code in this topic.
 
angevoyageur:
You can find sample code in this topic.
Thank you very much, alpari(UK)LTD MT5 is ECN mode,now i know the problem……
Reason: