StopLoss Question

 

I want use EA to test forex.

When I insert a StopLoss parameter (through OrderSend) the client terminal open a position with StopLoss Parameter.

The questions are:

_If i close the client terminal, when the price reach StopLoss the server close automatically the position?

_If the EA is active and, obviously, the client terminal is open, when the server automatically close the position how I can "intercept", in EA, this operation and write an alert?

thanks to all

 
davidze:

_If i close the client terminal, when the price reach StopLoss the server close automatically the position?

Yes.

_If the EA is active and, obviously, the client terminal is open, when the server automatically close the position how I can "intercept", in EA, this operation and write an alert?

thanks to all

You need to check each tick if the order closed - there are many ways to do this...

 

To check whether the order has been closed, loop through the order history pool checking orders against your criteria:

- eg. if your EA only places one order per day, then you can check for a match of DayOfYear() and Year(). Otherwise criteria could be OrderOpenTime(), OrderComment(), OrderMagicNumber() etc.


CB

 
cloudbreaker wrote >>

To check whether the order has been closed, loop through the order history pool checking orders against your criteria:

- eg. if your EA only places one order per day, then you can check for a match of DayOfYear() and Year(). Otherwise criteria could be OrderOpenTime(), OrderComment(), OrderMagicNumber() etc.

CB

Thanks!!

Reason: