Expert Advisor Details
ArchonV3
1.0.1

ArchonV3 attached to a live USDCAD chart
The Problem Archon Solves
Traditional Expert Advisors rely on static rule-based logic—if RSI crosses 30, buy; if price breaks resistance, sell. These systems fail because markets are non-linear. The relationship between indicators and profitable trades shifts constantly based on volatility regimes, session dynamics, and macro conditions.
Archon takes a fundamentally different approach: instead of hardcoding rules, it learns patterns from historical data using gradient-boosted decision trees. The model discovers which combinations of features—across multiple timeframes—predict profitable setups, without human bias dictating the logic.
System Architecture Overview
Archon consists of three layers:
Feature Engineering Layer — Extracts 56 market features from raw OHLCV data
Prediction Layer — Runs inference on trained XGBoost models via ONNX
Execution Layer — Manages entries, exits, risk, and position sizing
┌─────────────────────────────────────────────────────────────┐
│ ARCHON ARCHITECTURE │
├─────────────────────────────────────────────────────────────┤
│ │
│ Raw Market Data (M15, H1, H4) │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Feature Engine │ → 56 engineered features │
│ └────────┬────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ ONNX Runtime │ → XGBoost inference │
│ │ (per-pair) │ → Confidence scores │
│ └────────┬────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Trade Manager │ → Risk checks, position sizing │
│ │ │ → Entry/exit execution │
│ └─────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Feature Engineering: The 56-Feature Matrix
Raw price data is meaningless to a machine learning model. Archon's FeatureEngine module transforms OHLCV candles into a structured feature vector that captures market state across multiple dimensions.
Base Timeframe Features (M15) — 18 Features
These capture the immediate market context:
- •
Price Action: NormClose, BodySize, UpperWick, LowerWick
- •
Momentum: RSI(14), MACD, MACDSignal, MACDHist, StochK, StochD
- •
Volatility: ATR(14), BBWidth (Bollinger Band width)
- •
Trend: ADX, ADX+, ADX-, EMA200Slope
- •
Temporal: TimeToken (hour of day), DayOfWeek
Higher Timeframe Confirmation (H1, H4) — 16 Features
Multi-timeframe analysis prevents false signals. For both H1 and H4, we extract:
- •
RSI, MACDHist, ADX, ADX+, ADX-
- •
EMA200Slope, TrendDir, BBWidth
This gives the model structural context—is the M15 signal aligned with the higher timeframe trend?
Advanced Features — 22 Features
Beyond traditional indicators, Archon incorporates institutional trading concepts:
Support/Resistance Detection:
- •
SR_DistSupport — Distance to nearest support (ATR-normalized)
- •
SR_DistResistance — Distance to nearest resistance
- •
SR_Strength — Level strength based on touch count
- •
SR_InSupportZone, SR_InResistanceZone — Binary zone flags
Candlestick Pattern Recognition:
- •
Pattern_BullishScore — Aggregate bullish pattern confidence (0-1)
- •
Pattern_BearishScore — Aggregate bearish pattern confidence (0-1)
The pattern scorer detects 15 candlestick formations (Doji, Hammer, Engulfing, Morning Star, etc.) and assigns fuzzy confidence scores based on how closely the candle matches the ideal pattern geometry.
Smart Money Concepts (SMC):
- •
SMC_DistBullOB, SMC_DistBearOB — Distance to order blocks
- •
SMC_InFVG — Inside a Fair Value Gap
- •
SMC_DistLiquidity — Distance to liquidity zones
- •
SMC_BOS, SMC_CHOCH — Break of Structure / Change of Character signals
Chart Pattern Detection:
- •
Double Top/Bottom, Head & Shoulders, Triangles
- •
Chart_Completion — Pattern completion percentage
- •
Chart_BreakoutDir — Expected breakout direction
The Prediction Engine: XGBoost via ONNX
Each of the 8 supported pairs has its own dedicated model, trained exclusively on that instrument's historical data. This is critical—EURUSD does not behave like Gold, and a universal model would dilute edge.
Why XGBoost?
Gradient-boosted decision trees excel at finding non-linear relationships in structured/tabular data. Unlike neural networks, they:
- •
Don't require massive datasets to generalize
- •
Handle mixed feature types naturally
- •
Are interpretable (feature importance is extractable)
- •
Train fast and inference faster
ONNX Integration
Models are trained in Python using scikit-learn/XGBoost, then exported to ONNX format using the Hummingbird library. This converts the tree ensemble into tensor operations that run natively in MetaTrader 5.
# Python: Export XGBoost to ONNX
from hummingbird.ml import convert
import torch
pytorch_model = convert(xgb_model, 'torch')
dummy_input = torch.randn(1, 56) # 56 features
torch.onnx.export(
pytorch_model.model,
dummy_input,
"ForexXGB_EURUSD.onnx",
input_names=['input'],
output_names=['output'],
dynamic_axes={'input': {0: 'batch_size'}},
opset_version=14
)
The compiled .ex5 file embeds all 8 ONNX models as resources—no external file dependencies.
Feature Scaling
Before inference, features are normalized using MinMax scaling with parameters saved during training:
// MQL5: Scale features before inference
double range = g_ScalerMax[j] - g_ScalerMin[j];
if(range > 0)
value = (value - g_ScalerMin[j]) / range;
else
value = 0.5;
value = MathMax(0.0, MathMin(1.0, value));
Scaler parameters are embedded as CSV resources, loaded at runtime based on the detected symbol.
Confidence Thresholding
The model outputs class probabilities. Archon only executes trades when confidence exceeds 81%:
#define CONFIDENCE_MIN 0.81
if(confidence >= CONFIDENCE_MIN && positions < MAX_TRADES)
{
if(prediction == 1) // BUY
g_TradeManager.OpenBuy(sl, tp, "XGB");
else if(prediction == 2) // SELL
g_TradeManager.OpenSell(sl, tp, "XGB");
}
This filters out low-conviction signals, dramatically improving win rate at the cost of trade frequency.
Risk Management Architecture

Equity curve for ArchonV3
Archon implements institutional-grade risk controls designed for prop firm compliance:
Position Sizing
Lot size is calculated based on ATR-based stop loss distance and account risk percentage:
// Calculate SL distance
slDistance = atr * InpATRMultiplier; // Default: 3x ATR
// Risk-based position sizing
riskAmount = AccountBalance * (InpRiskPercent / 100);
lotSize = riskAmount / (slDistance / point * tickValue);
Daily Loss Limits
Trading halts if daily losses exceed the configured threshold (default 4%):
if(!g_TradeManager.CheckRiskLimits())
{
g_TradeManager.CloseAllPositions();
return; // Stop trading for the day
}
Maximum Drawdown Protection

ArchonV3 backtest results 2020-2025.
If total drawdown from peak equity exceeds 8%, all positions close and trading suspends.
News Filter
High-impact news events (NFP, FOMC, CPI) create unpredictable volatility. Archon auto-pauses trading 15 minutes before and after scheduled events using the MQL5 economic calendar.
Friday Close
All positions close at 20:00 server time on Fridays to avoid weekend gap risk.
Trailing Stop Modes
Archon offers four trailing stop strategies:
Chandelier Exit — Trails at N × ATR below the highest high (for longs)
Swing High/Low — Trails to recent swing points
Fixed Pips — Trails at a fixed pip distance
Percentage — Trails at a percentage of take profit distance
enum ENUM_TSL_MODE
{
TSL_NONE = 0, // No Trailing Stop
TSL_CHANDELIER = 1, // Chandelier Exit (ATR-based)
TSL_SWING = 2, // Swing High/Low
TSL_FIXED = 3, // Fixed Pips
TSL_PERCENT = 4 // Percentage of TP
};
Symbol Auto-Detection
Archon automatically detects the chart symbol and loads the appropriate model:
bool DetectSymbol()
{
string symbol = _Symbol;
// Try exact match
for(int i = 0; i < ArraySize(g_SupportedSymbols); i++)
{
if(symbol == g_SupportedSymbols[i])
{
g_ActiveSymbol = g_SupportedSymbols[i];
return true;
}
}
// Try with broker suffixes (EURUSD.ecn, EURUSDm, etc.)
for(int i = 0; i < ArraySize(g_SupportedSymbols); i++)
{
if(StringFind(symbol, g_SupportedSymbols[i]) == 0)
{
g_ActiveSymbol = g_SupportedSymbols[i];
return true;
}
}
return false; // Unsupported pair
}
This handles broker-specific symbol naming conventions automatically.
The Training Pipeline
Models are trained using a chronological split to prevent look-ahead bias:
Data Export: MQL5 script exports historical features + labels to CSV
Label Generation: Binary classification — did price move favorably within N bars?
Feature Pruning: Correlation analysis removes redundant features (threshold: 0.95)
Training: XGBoost with class weighting for imbalanced data
Validation: Walk-forward testing on out-of-sample periods
Export: Hummingbird converts to ONNX, scaler params saved to CSV
Each pair is trained independently on 3+ years of M15 data.
Performance Characteristics
Based on 5-year backtesting (2020-2025) across all 8 pairs:
- •
Profit Factor: 1.76
- •
Win Rate: ~56%
- •
Max Drawdown: 22%
- •
Recovery Factor: 4.27
- •
Average Trade Duration: 4-12 hours
The system is not a scalper—it takes fewer, higher-conviction trades with wider stops and lets winners run via trailing stops.
Why This Architecture Works
Per-pair specialization — Each model learns the unique characteristics of its instrument
Multi-timeframe confluence — M15 entries confirmed by H1/H4 structure
Confidence filtering — Only high-probability setups are traded
Institutional features — SMC, S/R, and pattern recognition capture what retail indicators miss
Embedded execution — No external dependencies, no API latency, no server costs
Archon represents a complete trading system—from feature engineering to risk management—packaged into a single self-contained Expert Advisor.
© 2026 Auron Automations. All rights reserved.