Download MetaTrader 5

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

To add comments, please log in or register
suoxinyang
72
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.

 

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);
    }
//+------------------------------------------------------------------+
Rogerio Figurelli
Moderator
44538
Rogerio Figurelli  
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?
suoxinyang
72
suoxinyang  
figurelli:
What broker are you using?
Alpari(UK)LTD
Simon Gniadkowski
Moderator
18042
Simon Gniadkowski  
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
Rogerio Figurelli
Moderator
44538
Rogerio 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). 

suoxinyang
72
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……
suoxinyang
72
suoxinyang  
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.
Alain Verleyen
Moderator
33615
Alain Verleyen  
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.
suoxinyang
72
suoxinyang  
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……
To add comments, please log in or register