Preventing Stop Out

 

Assuming all my trades have some StopLoss, how can I write a function that will determine if, given the direction (buy/sell), volume, and stoploss of a trade, it is possible to get a Stop Out.

For example, if I want to open a buy order when the Ask is 1.56432 with a stoploss at 1.56232 and a volume of 1 lot, the function should check all other open orders  and determine whether, in the event the price moves in the worst way possible for me, a Stop Out will be triggered and return a boolean accordingly.

Thanks in advance for your help.  I really appreciate it. 

 

Better try here ..

https://www.mql5.com/en/job

 
math-trader: Assuming all my trades have some StopLoss, how can I write a function that will determine if, given the direction (buy/sell), volume, and stoploss of a trade, it is possible to get a Stop Out.
Compute free margin at the most extreme adverse excursion for all open orders. See my LotSize calculation. Posted my code Why is there NO Complete EA within the Code-Base? - MQL4 forum It has not been adjusted for Build 600+.
Reason: