EA should start at random by selling (size 0.1) at market price:
1- sell 0.1 market price with SL 75 pips away and TP 45 pips away
2- simultaneously place STOP BUY 25 pips above original entry price with 75 pips SL and 45 pips TP. (size must be twice as big as all open position i.e. in this case 0.1 sell must be met by 0.2 buy)
this is where conditions start
A- if market moves down and hits TP the STOP BUY must be cancelled and EA start over by selling again at market price where it closed the original sell
B- is market moves up and triggers the STOP BUY two conditions scenarios could take place. Once STOP BUY is triggered, the EA must place a STOP SELL that makes the size of selling entries twice as big as the buy entries in that case 0.2 buy must be met with 0.4 sell, 0.1 already placed in original trade and 0.3 pending STOP SELL)
Here are the scenarios:
Scenario B1- market triggers STOP BUY (0.2) and moves up to reach the set TP it cancels the pending STOP SELL (0.3) and starts all over from step 1 by selling 0.1 with SL 75 pips and TP 45 pips and a simultaneous STOP BUY 25 pips away and above entry price.
Scenario B2- is market trigger STOP BUY (0.2) but never reaches the TP level but instead turns back down and triggers the STOP SELL (0.3) a simultaneous STOP BUY with same entry, SL and TP as the first STOP BUY (0.2) is placed however the size is different. at this point we have (sell 0.1+0.3 =0.4 and buy: 0.2 to double the size of open sells we need 0.8 buys hence the size of the pending STOP BUY must be 0.6) fs the market continues down and reaches the TP of the sell trades it cancels any pending conditional orders and starts over from the begining by selling (0.1) at market order. if market never reaches the TP and goes back up and tiggers the STOP BUY (0.6) a STOP SELL with size of 1.2 and identical entry, sl and tp os the very trade is put in place and so on...
The variable should be the size of the very first trade, the hedge limits, the take profit and the stop loss.
I am attaching an excel sheet to explain the conditions and show the possible cash flow in pips