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.

Strategie — szczegółowy opis algorytmów

3. Strategie — szczegółowy opis algorytmów

3.1 Smart DI (Directional Index)

Idea: Mierzy dominację jednego kierunku rynkowego na podstawie wskaźnika ADX, analizując różnicę między liniami DI+ i DI-.

Algorytm krok po kroku:

  1. Pobiera wartości DI+ i DI- z ADX (bufor 1 — poprzednia zamknięta świeca, by uniknąć repaintingu)
  2. Oblicza diff = |DI+ - DI-|
  3. Pobiera dane ostatniej zamkniętej świecy na Inp_Strat_TF
  4. Oblicza rozmiar ciała świecy: body = |close - open| / _Point
  5. Jeśli aktywny Impulse/Muzzle Mode: minimalne ciało świecy wzrasta z Inp_Strat_Min_Candle_Body do Inp_Muzzle_Min_Candle_Body (domyślnie 150 pkt zamiast 2 pkt) — charakterystyka strategii zmienia się podczas impulsu
  6. Sygnał BUY: DI+ > DI- AND diff > Min_DI_Diff AND DI- < Max_Opposite_DI
  7. Sygnał SELL: DI- > DI+ AND diff > Min_DI_Diff AND DI+ < Max_Opposite_DI

Log: "Smart DI BUY" / "Smart DI SELL"

Kluczowa właściwość: Parametr Inp_Strat_Max_Opposite_DI ogranicza siłę opozycji — nawet jeśli DI+ dominuje, zbyt silne DI- blokuje sygnał. Działa jako wbudowany filtr jakości trendu.

3.2 MTF Point System (Multi-TimeFrame)

Idea: Scoring zgodności trendu na 4 niezależnych timeframach przy użyciu krzyżowania EMA5/EMA7. Punktuje każdy timeframe i wymaga minimum X punktów.

Algorytm krok po kroku:

  1. Na każdym z 4 timeframów (TF1, TF2, TF3, TF4) pobiera EMA5 i EMA7
  2. BUY point: EMA5 > EMA7 na danym TF → score++
  3. SELL point: EMA5 < EMA7 na danym TF → score++
  4. Jeśli score >= Inp_MTF_Min_Score (domyślnie 3 z 4) → sygnał aktywny

Warunek sprawdzania: Co nowy bar na Inp_MTF_TF1 (najszybszy TF)

Log: "MTF BUY" / "MTF SELL"

Filozofia: System nie wymaga stuprocentowej zgodności — nawet 3 na 4 TF jest wystarczające. Daje elastyczność przy płynnych rynkach, gdzie wszystkie TF rzadko wskazują jednocześnie.

3.3 Three Consecutive Candles (3 Candles)

Idea: Wykrywa mini-trend: 3 kolejne zamknięte świece o tym samym kierunku z minimalnym ciałem.

Algorytm krok po kroku:

  1. Pobiera 3 ostatnie zamknięte świece na Inp_Filter_3Candles_TF
  2. Dla każdej świecy: body = |close - open| / _Point
  3. Jeśli ciało którejkolwiek świecy < Inp_Filter_3Candles_MinBody → sygnał fałszywy
  4. BUY: wszystkie 3 świece są wzrostowe (close > open)
  5. SELL: wszystkie 3 świece są spadkowe (close < open)

Log: "3 Candles BUY" / "3 Candles SELL"

Siła: Prosta, wizualnie intuicyjna, bardzo skuteczna jako walidator — potwierdza momentum zanim Smart DI lub MTF dadzą sygnał.