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.

Multi-Core Strategy Engine — „First Come, First Served”

2. Multi-Core Strategy Engine — „First Come, First Served”

This is the system’s most important architectural innovation. Despite the name suggesting a single strategy, AHS is a strategy engine with interchangeable cores, where each strategy can simultaneously fulfil two roles:

RoleParameterDescription
Trigger_As_Strategy = trueThe strategy GENERATES the trade signal
Validator_As_Filter = trueThe strategy CONFIRMS signals from other strategies

The „First Come, First Served” Rule

Strategies are evaluated sequentially in a fixed order:

EvaluateStrategies()
  1. Smart DI (if As_Strategy=true)       → signal? → filters → order → RETURN
  2. MTF Point System (if As_Strategy=true) → signal? → filters → order → RETURN
  3. 3 Consecutive Candles (if As_Strategy=true) → signal? → filters → order → RETURN

Critical implication: When strategy #1 (Smart DI) generates a valid signal and passes all filters, the system immediately opens an order and exits the function (return). Strategies 2 and 3 are never evaluated on that tick. There is no voting, averaging or consensus — the first valid signal wins.

Each strategy is checked only once per new bar (on its own timeframe), which eliminates multiple signals within the same candle.

Configuration Possibilities

  • SmartDI as trigger, MTF + 3Candles as filters — SmartDI fires the signal, but it must be confirmed by both other systems
  • All three as triggers — three independent strategies compete to open a trade
  • MTF as trigger, SmartDI as filter — MTF generates, SmartDI confirms
  • Any combination — each strategy can be independently enabled/disabled in either role

A Validator Does Not Validate Itself

Smart logic: strategy X acting as a filter does NOT validate its own signals. Example: if SmartDI is the trigger, the SmartDI filter is skipped (it does not check itself) — only MTF and 3Candles filters are checked.

// Validator skips its own source
if (Inp_SmartDI_As_Filter && trigger_source != "SmartDI") {
    if (!CheckSmartDI_Condition(is_buy)) return false;
}

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ł.

Multi-Core Strategy Engine — „kto pierwszy ten lepszy”

2. Multi-Core Strategy Engine — „kto pierwszy ten lepszy”

Jest to najważniejsza innowacja systemu. Wbrew nazwie sugerującej jedną strategię, AHS to silnik z wymiennymi rdzeniami strategii, gdzie każda strategia może jednocześnie pełnić dwie role:

RolaParametrOpis
Trigger (wyzwalacz)_As_Strategy = trueStrategia GENERUJE sygnał transakcyjny
Validator (walidator)_As_Filter = trueStrategia POTWIERDZA sygnały innych

Zasada „kto pierwszy ten lepszy” (First-Come-First-Served)

Strategie są ewaluowane sekwencyjnie w stałej kolejności:

EvaluateStrategies()
  1. Smart DI (jeśli As_Strategy=true)  → sygnał? → filtry → zlecenie → RETURN
  2. MTF Point System (jeśli As_Strategy=true) → sygnał? → filtry → zlecenie → RETURN
  3. 3 Consecutive Candles (jeśli As_Strategy=true) → sygnał? → filtry → zlecenie → RETURN

Kluczowe znaczenie: Gdy strategia nr 1 (Smart DI) wygeneruje sygnał i przejdzie przez wszystkie filtry, system natychmiast otwiera zlecenie i wychodzi z funkcji (return). Strategie 2 i 3 nie są już w tym ticku sprawdzane. Nie ma głosowania, uśredniania ani konsensusu — pierwszy ważny sygnał wygrywa.

Każda strategia sprawdzana jest tylko raz na nowy bar (na własnym timeframie), co eliminuje wielokrotne sygnały wewnątrz tej samej świecy.

Możliwe konfiguracje

  • SmartDI jako trigger, MTF+3Candles jako filtry — SmartDI daje sygnał, ale muszą go potwierdzić oba pozostałe systemy
  • Wszystko jako trigger — trzy niezależne strategie rywalizują o otwarcie zlecenia
  • MTF jako trigger, SmartDI jako filter — MTF generuje, SmartDI potwierdza
  • Dowolna kombinacja — każda strategia może być włączona/wyłączona niezależnie w obu rolach

Walidator nie weryfikuje samego siebie

Inteligentna logika: strategia X działając jako filtr NIE waliduje sygnałów własnych. Przykład: jeśli SmartDI jest wyzwalaczem, filtr SmartDI jest pomijany (nie sprawdza sam siebie) — sprawdzane są tylko filtry MTF i 3Candles.

// Walidator pomija własne źródło
if (Inp_SmartDI_As_Filter && trigger_source != "SmartDI") {
    if (!CheckSmartDI_Condition(is_buy)) return false;
}
Adaptive Hybrid System - Multi-Core Strategy Engine -US100
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.