EA, if bothered by stopout ?

 

Hi,

In my EA, which in a considerable market move will open say 10 positions gradually, one by one .

I'm thinking about: say after 7 positions opened, a stopout happens, how do I prevent EA from openning the other 3 positions? .... maybe the question is: how to know a stopout happened.

Any idea?

 
joshatt:

Hi,

In my EA, which in a considerable market move will open say 10 positions gradually, one by one .

I'm thinking about: say after 7 positions opened, a stopout happens, how do I prevent EA from openning the other 3 positions? .... maybe the question is: how to know a stopout happened.

Any idea?

"stopout" ? do you mean an Order closed due to it's Stop Loss ? if so all you can do is check the History pool and check the OrderClose() price compared to the OrderStopLoss() if it's the same then you can conclude it was closed due to SL, if it's close the it may also be due to SL.
 

Stopout means closed due to a margin call.

Instead of trying to stop after a margin call, why don't you prevent them? Don't open an order that could. Verify that you will have free margin at the most adverse excursion (i.e. SL) for ALL orders (new and open) See my code

 
RaptorUK:
"stopout" ? do you mean an Order closed due to it's Stop Loss ? if so all you can do is check the History pool and check the OrderClose() price compared to the OrderStopLoss() if it's the same then you can conclude it was closed due to SL, if it's close the it may also be due to SL.


Thanks for the tip, I'll do that.
 
WHRoeder:

Stopout means closed due to a margin call.

Instead of trying to stop after a margin call, why don't you prevent them? Don't open an order that could. Verify that you will have free margin at the most adverse excursion (i.e. SL) for ALL orders (new and open) See my code


Great powerful codes!

Actually this EA is for a friend, who often uses this kind of extreme money management...... margincall as a tool.