Strategies — Detailed Algorithm Descriptions

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:

  1. Fetches DI+ and DI- values from ADX (buffer 1 — the previous closed bar, to avoid repainting)
  2. Calculates diff = |DI+ - DI-|
  3. Fetches data for the last closed candle on Inp_Strat_TF
  4. Calculates candle body size: body = |close - open| / _Point
  5. If Impulse/Muzzle Mode is active: the minimum candle body requirement rises from Inp_Strat_Min_Candle_Body to Inp_Muzzle_Min_Candle_Body (default 150 pts instead of 2 pts) — the strategy’s characteristics change during an impulse
  6. BUY signal: DI+ > DI- AND diff > Min_DI_Diff AND DI- < Max_Opposite_DI
  7. SELL signal: DI- > DI+ AND diff > Min_DI_Diff AND DI+ < 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:

  1. On each of the 4 timeframes (TF1, TF2, TF3, TF4), fetches EMA5 and EMA7
  2. BUY point: EMA5 > EMA7 on that TF → score++
  3. SELL point: EMA5 < EMA7 on that TF → score++
  4. 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:

  1. Fetches the last 3 closed candles on Inp_Filter_3Candles_TF
  2. For each candle: body = |close - open| / _Point
  3. If any candle’s body < Inp_Filter_3Candles_MinBody → signal is invalid
  4. BUY: all 3 candles are bullish (close > open)
  5. 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.