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
Need mobile version of MetaTrader 5? Download it and trade!
suoxinyang
73
suoxinyang 2013.04.22 04:09 

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
39652
Rogerio Figurelli 2013.04.22 07:00  
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
73
suoxinyang 2013.04.22 07:40  
figurelli:
What broker are you using?
Alpari(UK)LTD
Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2013.04.22 09:35  
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
39652
Rogerio Figurelli 2013.04.22 12:38  

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
73
suoxinyang 2013.04.22 14:45  
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
73
suoxinyang 2013.04.22 14:49  
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
30739
Alain Verleyen 2013.04.22 15:00  
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
73
suoxinyang 2013.04.22 15:07  
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