S and R 369

369 Quant Signal Generator

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.

369 QUANT · SIGNAL
8Filter Layers
H1 + M15Dual Timeframe
50–61.8%Fib Golden Pocket
2 : 1Default Risk/Reward
5 sPoll Interval

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

STEP 01
Spread Guard
Aborts if live spread exceeds the configurable threshold — prevents bad fills during news spikes.
STEP 02
Session Filter
Signals only fire during London (07–12 UTC) and/or New York (12–20 UTC) sessions — peak liquidity windows.
STEP 03
Break of Structure
Identifies confirmed swing highs/lows on the BOS timeframe and detects the last closed bar breaking that structure.
STEP 04
Fibonacci Pullback
Verifies price has retraced into the 50–61.8% golden pocket of the BOS impulse before entry is considered.
STEP 05
EMA Trend Filter
Cross-checks price vs. the 50-period EMA on the entry timeframe; only trades aligned with the higher trend.
STEP 06
Candle Confirmation
Requires a strong directional candle (body ≥ 55% of range) on the entry TF — filters out indecision bars.
STEP 07
Minor BOS
Demands a micro-structure break on the entry TF, confirming institutional order-flow at the pullback level.
STEP 08
ATR-Based SL/TP
Calculates structure-based SL (below/above Fib zone) with ATR fallback, and TP at 2× risk by default.
STEP 09
Atomic JSON Write
Signal packet written atomically to disk — EA reads, executes, then archives the file, preventing any duplicate trades.

System Architecture

🐍
Python Bot
Signal Generator
📡
MT5 API
OHLC · Tick Data
🔬
8-Layer Filter
BOS · Fib · EMA
📄
signal.json
Atomic file write
⚙️
Bridge EA
MT5 execution

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

🧠
Dual-Timeframe Analysis
BOS detected on H1 (macro context), entry confirmed on M15 (precision timing) — mirrors professional SMC methodology.
🎯
Golden Pocket Entry
Only enters in the 50%–61.8% Fibonacci retracement zone — the area with the highest institutional demand/supply confluence.
🔒
Structure-Based SL
Stop-loss is placed below/above the Fibonacci pullback zone floor/ceiling, not an arbitrary ATR offset, for tighter risk exposure.
🕐
Session-Aware Execution
Built-in London and New York session filters ensure signals only fire when the market has real institutional participation.
One Signal Per Candle
A robust bar-gating mechanism prevents duplicate signals on the same candle close — clean, non-spammy output.
📦
Full JSON Signal Schema
Every signal carries entry, SL, TP, ATR, BOS levels, Fib zone, Martingale step, expiry time, and a unique UUID — complete audit trail.
🔄
Martingale Escalation
Optional configurable Martingale steps (up to 3) activate only after a loss in the same direction — with a hard cap for protection.
📁
Auto Archive System
Stale, expired, or consumed signal files are automatically moved to an archive sub-folder, keeping the signal folder clean.
🖥️
Timestamped Logging
Every step of every signal cycle is logged to both console and a rotating log file — full transparency for review and debugging.

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:

{ "schema_version": 3, "signal_id": "a7f3-uuid4-string", "generated_utc": "2025-01-15T08:32:14Z", "candle_utc": "2025-01-15T08:00:00Z", "symbol": "XAUUSD", "timeframe": "H1", "direction": "BUY", "entry": 2345.50, "sl": 2330.00, "tp": 2376.00, "sl_pts": 154, "atr": 8.50, "bos_level": 2340.00, "bos_origin": 2310.00, "fib_low": 2325.00, "fib_high": 2331.58, "mart_step": 0, "status": "PENDING", "expiry_utc": "2025-01-15T09:00:00Z", "source": "369_python_bot" }

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:

pip install MetaTrader5 pandas numpy

Then run the signal generator:

python signal_generator_369.py

Compatibility

Python 3.8+MetaTrader 5Windows 10/11XAUUSD · Forex · IndicesAny MT5 Broker

 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.

369 Quant Signal Generator  ·  Python Signal Engine for MetaTrader 5
Past performance does not guarantee future results. Trade res

Filtro:
Nessuna recensione
Rispondi alla recensione