Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1271

 
Alexey Viktorov:

Never used it, but I think we should check transaction type TRADE_TRANSACTION_ORDER_UPDATE

It is obvious. What should I check next?

 
leonerd:

This is obvious. What should I check next?

action in MqlTradeRequest?

 
leonerd:

action in MqlTradeRequest?

no, it does not

 
trans.order_state==ORDER_STATE_REQUEST_MODIFY
that doesn't work either
 
leonerd:
that doesn't work either.

Dude, kudos and respect to you! You're trying something. Most people ask and then only whine that it was not explained to them. )))

 
leonerd:

This is obvious. What's next to check?

Obviously, compare the price "yesterday" and "today". Roughly speaking, what it was and what it is now. If it has changed, then that's what it is.

 
Alexey Viktorov:

Obviously, compare the price "yesterday" and "today". Roughly speaking, what it was and what it is now. If it's changed, then that's what it is.

So, should I store yesterday's price somewhere? I can't get it in OnTradeTransaction, can I?

 
leonerd:

So I have to store yesterday's price somewhere? I can't get it in OnTradeTransaction, can I?

Only when placing an order. Transaction type TRADE_TRANSACTION_ORDER_ADD

And then it has to be stored until it is changed.

 

You to

Alexey Viktorov:

Only when an order is placed. Transaction type TRADE_TRANSACTION_ORDER_ADD

And then it has to be stored until changed.

How do you even imagine this? I store all orders and their open prices in some kind of array or list. Every time I update(TRADE_TRANSACTION_ORDER_UPDATE) I have to run through the list to find the order with the needed ticket? Isn't there an elegant solution?

 
leonerd:

Are you to...

How do you even conceive of this? I store all orders and their open prices in some array or list. Every time I update it(TRADE_TRANSACTION_ORDER_UPDATE) I have to run through the list to find an order with the needed ticket? Isn't there some elegant solution?

It depends on the purpose of catching the update. How about to simply reload the array?

Reason: