Работа завершена
Техническое задание
Here’s a concise programmer-friendly summary of the strategy logic:
📘 EMA100 > SMA200 Martingale Strategy Summary
🔁 Trend Filter
-
Only trade if: EMA(100) > SMA(200)
-
Pause trading if: EMA(100) < SMA(200)
-
Let existing trades close via TP, TSL, or retracement.
-
Wait until EMA(100) crosses back above SMA(200) before resuming.
-
✅ Entry Condition
-
On crossover ( EMA100 crosses above SMA200 ), wait for confirmation distance D .
-
Then open a Sell trade using InitialLotSize .
🔻 Sell Trade Logic
-
If TP is hit:
→ Open a new Sell with InitialLotSize . -
If profit retraces by M pips:
→ Close Sell, open Buy with same lot size. -
If TSL is hit:
→ Close Sell, open Buy with:
LotSize = LastLot × MartingaleMultiplier (1.7 for trades 1–8, 1.5 for trades 9–12) -
At trade #12 + TSL hit:
→ Reset to Level 1 using InitialLotSize .
🔺 Buy Trade Logic
-
Only allowed when EMA100 > SMA200 .
-
If TP is hit:
→ Re-enter Sell with InitialLotSize . -
If profit retraces by M pips:
→ Close Buy, open Sell with same lot size. -
If TSL is hit:
→ Close Buy, open Sell with:
LotSize = LastLot × MartingaleMultiplier
🔁 Post-Reentry After EMA > SMA Again
-
Wait for confirmation distance D after EMA crosses back above SMA.
-
Depending on how the last trade closed:
-
TP: Sell with InitialLotSize
-
Retracement: Buy with same lot size
-
TSL: Buy with LastLot × MartingaleMultiplier
-
⚙️ Input Parameters
InitialLotSize ConfirmationDistance TakeProfit BuySL, SellSL PnLRetracement (M) MartingaleMultiplier1 (1.7) MartingaleMultiplier2 (1.5) TrailingStopSell, TrailingStepSell TrailingStopBuy, TrailingStepBuy
📌 Notes
-
Only 1 open trade at a time
-
TP/TSL settings differ for Buy/Sell
-
Strategy resets after 12 losing trades
-
Trade direction after loss depends on exit type
-
anytime trade hit sl or TSL, we increase lotsize by multiplier