if(G1[GridArrayLevel].Grid_Buy_Pos==0 && CurrentLevel!=CurrentLevelCopy)
//open buy order
request.magic = g_4magic;
request.action = TRADE_ACTION_DEAL;
request.type = ORDER_TYPE_BUY;
request.symbol = _Symbol;
request.volume = TradeVolume;
request.type_filling = ORDER_FILLING_IOC;
request.price = G1[GridArrayLevel].Grid_Level;
request.tp = 0;
request.deviation = 50;
if(result.retcode == TRADE_RETCODE_PLACED || result.retcode == TRADE_RETCODE_DONE)
while(PositionSelect(_Symbol) == false);
I used the above code to store ticket of a position. the ticket stored was 210877044 while that shown beside position was 210921939. The journal shows both of them related to same market order.
perhaps,because of this confusion my EA is not closing any trades.
moreover it worked fine while backtesting, and this error poped up during testing on a demo account.
what can i do to get the ticket number shown beside my position in trade-toolbox window.
okay. i solved it.
Just changed the deal ticket to order ticket.
second last line to result.order and it is working fine in live trading.
However, at both instances my EA worked fine with backtesting, don't know why.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.