As you can see on my example the ResultDeal is not a good indicator to check if my order has been executed since it always keeping the value 0. So which condition should I use to make sure transaction has been executed on the server side ?
Something like that. There are several ways to do it, using OnTrade() or OnTradeTransaction() as suggested by Anthony is better than waiting a new tick.
Of course trade.ResultDeal() will never be updated.
You are mixing deal, order and position.
Something like that. There are several ways to do it, using OnTrade() or OnTradeTransaction() as suggested by Anthony is better than waiting a new tick.
Hi Alain,
Ok I understand that trade.ResultDeal will never be updated.
However does trade.ResultOrder will always contain an order number if no errors are found as showed in the example:
int lastTicketNumber;
int openPosition(ENUM_ORDER_TYPE cmd, double volume)
{
...
if(!trade.PositionOpen(_Symbol,cmd,size,openPrice,0,0,RobotName+" "+timeframeToString(_Period)) || trade.ResultRetcode()!=TRADE_RETCODE_DONE)
{
lastErrorMessage="Position open failed. Return code="+IntegerToString(trade.ResultRetcode());
lastDateErrorMessage=TimeCurrent();
Print("code retour du trade:",trade.ResultRetcode());
return -1;
}
lastTicketNumber=(int) trade.ResultOrder(); // Does result order will be always superior to 0return lastTicketNumber;
}
I am asking this question because I would like to use the variable lastTicketNumber to identified the execution of the transaction in the function OnTradeTransaction()
Ok I understand that trade.ResultDeal will never be updated.
However does trade.ResultOrder will always contain an order number if no errors are found as showed in the example:
I am asking this question because I would like to use the variable lastTicketNumber to identified the execution of the transaction in the function OnTradeTransaction()
Regards,
Dorian
Yes it should.
Please note that your way to filter "no errors" is incorrect. TRADE_RETCODE_DONE is not the only "no errors" answer.
HI Dorian. I'm Still NOT able 2 - Get the '' Double Top Tracker'' 2 - Work after Purchasing the tool.. I've Install It Several times Hoping that Would Work, But Still Nothing.. I've tried dorian75 Still NO response From U - I'm running OUT Of Ideas!!
It may happens there is never a deal, even when the order was accepted.
Here is the code I am using:
Result:
ResulDeal keeps always the value 0 even though the position has been received by the server.
So what is wrong in my code ?
Regards,
Dorian
So what is wrong in my code ?
What do you want?
What do you want?
As you can see on my example the ResultDeal is not a good indicator to check if my order has been executed since it always keeping the value 0. So which condition should I use to make sure transaction has been executed on the server side ?
Regards,
Dorian
I monitor in the OnTradeTransaction() event. This is similar to @fxsaber 's solution.
Thanks Anthony. The event handler "OnTradeTransaction()" is a good indicator to check if my transaction has been executed.
Here is the code I am using:
Result:
ResulDeal keeps always the value 0 even though the position has been received by the server.
Of course trade.ResultDeal() will never be updated.
You are mixing deal, order and position.
So what is wrong in my code ?
Of course trade.ResultDeal() will never be updated.
You are mixing deal, order and position.
Something like that. There are several ways to do it, using OnTrade() or OnTradeTransaction() as suggested by Anthony is better than waiting a new tick.Hi Alain,
Ok I understand that trade.ResultDeal will never be updated.
However does trade.ResultOrder will always contain an order number if no errors are found as showed in the example:
I am asking this question because I would like to use the variable lastTicketNumber to identified the execution of the transaction in the function OnTradeTransaction()
Regards,
Dorian
Hi Alain,
Ok I understand that trade.ResultDeal will never be updated.
However does trade.ResultOrder will always contain an order number if no errors are found as showed in the example:
I am asking this question because I would like to use the variable lastTicketNumber to identified the execution of the transaction in the function OnTradeTransaction()
Regards,
Dorian
Yes it should.
Please note that your way to filter "no errors" is incorrect. TRADE_RETCODE_DONE is not the only "no errors" answer.
It may happens there is never a deal.