Download MetaTrader 5

shall I know an order has been closed at once?

To add comments, please log in or register
Interested in Signals activity? Come and track!
Fa Cao
1141
Fa Cao 2014.01.10 10:02 

when I open an order some time, but some time the order had been closed at stop loss, shall I know it immediately when the order is closed at once by EA and send an reverse order?

is there some function to do this?

if not, how I should set to achieve this target?

in the fact, I have make codes to do this, by orderselect(ordershistorytotal()-1, select_by_pos, mode_history), but most time the reverse order has been sent after many bars.

Simon Gniadkowski
Moderator
17999
Simon Gniadkowski 2014.01.10 10:09  
vx0532:

when I open an order some time, but some time the order had been closed at stop loss, shall I know it immediately when the order is closed at once by EA and send an reverse order?

is there some function to do this?

if not, how I should set to achieve this target?

in the fact, I have make codes to do this, by orderselect(ordershistorytotal()-1, select_by_pos, mode_history), but most time the reverse order has been sent after many bars.

I do something similar to take Screen grabs of newly closed trades, I keep track of the last trade a Screen grab was created for, I check for trades with OrderCloseTimes() newer than the last one Grabbed and when I find a newer closed trade I take a new Grab. This code is executed outside of any "once per bar" code so it can happen more frequently.
Fa Cao
1141
Fa Cao 2014.01.13 02:04  

ok

Thanks a lot!

To add comments, please log in or register