S and R 369
- Experts
- Allan Njuguna Kimani
- Versione: 2.14
- Attivazioni: 5
A precision-engineered Python signal pipeline for MetaTrader 5 — combining Break of Structure, Fibonacci retracement, and EMA trend-alignment into one seamless, automated signal engine.
Overview
The 369 Quant Signal Generator is a Python-based signal engine that connects directly to MetaTrader 5 and autonomously detects high-probability trade setups using a structured, multi-layer methodology. It runs continuously in the background, scanning your chosen symbols every 5 seconds, and writes atomic JSON signal files that are instantly consumed by the companion Signal_Bridge_EA on the MT5 chart side — with zero manual intervention required.
Built on the proven 369 structural edge — Break of Structure → Fibonacci Pullback → Entry Confirmation — this tool eliminates emotional discretion and enforces a rule-based entry model on every single signal. The Python layer and the MT5 EA share identical parameter mirrors so both sides always analyse the same market conditions.
How It Works — The 9-Step Signal Pipeline
System Architecture
The Python script and the MT5 Expert Advisor communicate through a shared JSON signal file. The EA reads each validated signal, executes the trade, and renames the file to prevent re-execution — creating a clean, crash-safe handoff with no TCP dependencies.
Key Features
Signal Output — JSON Schema
Each validated signal is written as a structured JSON packet consumed by the Bridge EA. Every field is documented and versioned:
Input Parameters
🔌 MT5 Connection
| Parameter | Default | Description |
|---|---|---|
| mt5_login | 0 | MT5 account number. Set to 0 to use the currently logged-in account in the terminal. |
| mt5_password | "" | Account password. Leave blank when using the active terminal session. |
| mt5_server | "" | Broker server name (e.g. "ICMarketsEU-Demo"). Leave blank for active session. |
📈 Symbols & Timeframes
| Parameter | Default | Description |
|---|---|---|
| symbols | ["XAUUSD"] | List of symbols to monitor. Add multiple: ["XAUUSD", "EURUSD", "GBPUSD"]. |
| bos_tf | H1 | Timeframe used for Break of Structure detection (macro context layer). |
| entry_tf | M15 | Timeframe used for entry model confirmation — candle body, minor BOS, and EMA check. |
| lookback | 150 | Number of historical bars fetched per symbol per cycle. Increase for slower timeframes. |
🏗️ Break of Structure (BOS)
| Parameter | Default | Description |
|---|---|---|
| bos_swing_len | 10 | Number of bars required on each side of a pivot to confirm a valid swing high or low. |
| bos_lookback | 100 | How many bars back to scan for swing points during BOS detection. |
🎯 369 Entry Model (Fibonacci + Confirmation)
| Parameter | Default | Description |
|---|---|---|
| fib_min | 0.50 | Minimum Fibonacci retracement depth (50%) for the golden pocket pullback zone. |
| fib_max | 0.618 | Maximum Fibonacci retracement depth (61.8%) — the upper boundary of the entry zone. |
| body_wick_ratio | 0.55 | Minimum body-to-range ratio for the confirmation candle. Set to 0 to disable this filter. |
| minor_swing_len | 3 | Bars each side to identify minor swing highs/lows for the entry-TF micro-structure break. |
⚖️ ATR, Stop-Loss & Take-Profit
| Parameter | Default | Description |
|---|---|---|
| atr_period | 14 | ATR lookback period used for volatility measurement and SL fallback calculation. |
| sl_atr_mult | 1.5 | SL distance as a multiple of ATR — used only when structure SL produces an invalid level. |
| sl_buffer_pts | 30 | Extra buffer in points added beyond the Fib zone boundary for the structure-based SL. |
| tp_rr | 2.0 | Take-profit risk-to-reward ratio. Default 2.0 means TP is placed at 2× the SL distance. |
📊 EMA Trend Filter
| Parameter | Default | Description |
|---|---|---|
| use_ma_trend | True | Enable/disable the EMA trend alignment filter. Disable to trade counter-trend setups. |
| ma_period | 50 | Period of the Exponential Moving Average used for trend direction on the entry timeframe. |
🕐 Session Filter
| Parameter | Default | Description |
|---|---|---|
| use_london | True | Enable the London trading session window. |
| london_start_h | 7 | London session start hour (UTC). |
| london_end_h | 12 | London session end hour (UTC). |
| use_newyork | True | Enable the New York trading session window. |
| ny_start_h | 12 | New York session start hour (UTC). |
| ny_end_h | 20 | New York session end hour (UTC). |
🛡️ Execution Guards & Martingale
| Parameter | Default | Description |
|---|---|---|
| max_spread_pts | 30.0 | Maximum allowable spread in points. Signals are suppressed if live spread exceeds this value. |
| mart_max_steps | 3 | Maximum Martingale escalation steps after consecutive losses in the same direction. Set to 0 to disable. |
📂 Signal Output
| Parameter | Default | Description |
|---|---|---|
| signal_folder | C:/Users/Public/369_signals | Directory where signal.json is written. Must match InpSignalFolder in the Bridge EA. |
| signal_expiry_bars | 1 | Number of BOS-TF candles after which an unexecuted signal is considered stale and archived. |
| poll_seconds | 5.0 | How frequently (in seconds) the main loop checks for new candle closes and signal opportunities. |
Requirements & Installation
Install the required Python packages with a single command:
Then run the signal generator:
Compatibility
⚡ Plug-and-play design: The 369 Signal Generator is built to pair directly with the Signal_Bridge_EA.mq5 Expert Advisor. Together they form a complete, end-to-end automated trading pipeline — Python handles all the analytical heavy lifting while the EA handles the MT5-native order execution. Both components share identical parameter mirrors, guaranteeing perfect synchronisation of logic across the Python and MQL5 layers.
Past performance does not guarantee future results. Trade res
