3. Strategies — Detailed Algorithm Descriptions
3.1 Smart DI (Directional Index)
Concept: Measures the dominance of one market direction using the ADX indicator, analysing the difference between the DI+ and DI- lines.
Algorithm — step by step:
- Fetches
DI+andDI-values from ADX (buffer 1 — the previous closed bar, to avoid repainting) - Calculates
diff = |DI+ - DI-| - Fetches data for the last closed candle on
Inp_Strat_TF - Calculates candle body size:
body = |close - open| / _Point - If Impulse/Muzzle Mode is active: the minimum candle body requirement rises from
Inp_Strat_Min_Candle_BodytoInp_Muzzle_Min_Candle_Body(default 150 pts instead of 2 pts) — the strategy’s characteristics change during an impulse - BUY signal:
DI+ > DI-ANDdiff > Min_DI_DiffANDDI- < Max_Opposite_DI - SELL signal:
DI- > DI+ANDdiff > Min_DI_DiffANDDI+ < Max_Opposite_DI
Log: "Smart DI BUY" / "Smart DI SELL"
Key property: The Inp_Strat_Max_Opposite_DI parameter limits opposition strength — even when DI+ dominates, an overly strong DI- blocks the signal. It acts as a built-in trend quality filter.
3.2 MTF Point System (Multi-TimeFrame)
Concept: Scores trend alignment across 4 independent timeframes using EMA5/EMA7 crossovers. Each timeframe earns one point; a minimum score threshold is required.
Algorithm — step by step:
- On each of the 4 timeframes (
TF1, TF2, TF3, TF4), fetches EMA5 and EMA7 - BUY point: EMA5 > EMA7 on that TF → score++
- SELL point: EMA5 < EMA7 on that TF → score++
- If
score >= Inp_MTF_Min_Score(default 3 out of 4) → signal is active
Check condition: On every new bar of Inp_MTF_TF1 (the fastest TF)
Log: "MTF BUY" / "MTF SELL"
Philosophy: The system does not require perfect alignment — even 3 out of 4 timeframes is sufficient. This provides flexibility in fluid markets where all timeframes rarely agree simultaneously.
3.3 Three Consecutive Candles
Concept: Detects a mini-trend: 3 consecutive closed candles in the same direction with a minimum body size.
Algorithm — step by step:
- Fetches the last 3 closed candles on
Inp_Filter_3Candles_TF - For each candle:
body = |close - open| / _Point - If any candle’s body <
Inp_Filter_3Candles_MinBody→ signal is invalid - BUY: all 3 candles are bullish (
close > open) - SELL: all 3 candles are bearish (
close < open)
Log: "3 Candles BUY" / "3 Candles SELL"
Strength: Simple, visually intuitive, and highly effective as a validator — it confirms momentum before Smart DI or MTF fire their signals.
