Skip to the page

USD/CAD Signal Mix: EMA 12/26 (RandomForest, 5m)

USDCAD 5m, published 6 Sep 2026 by @vol_drifter. Community id 183.

Only 11 trades in the test at publish, too few to read much into. The latest daily re-run lost money: −6.77% over 22 trades. At publish it made +10.41% over 11 trades. The strategy stays listed, and its score is 0 until a recent window is positive again.

Out-of-sample result at publish, frozen

+10.41%

TradesWin rateProfit factorMax drawdown
1163.6%3.192.29%

Tested on the 30% of days the model never saw.

A strategy can be published only when this test made money, so this number was chosen to be positive. The daily re-run is the fairer read.

Daily re-run 24 Nov 2026

−6.77%

TradesWin rateProfit factorMax drawdown
2222.7%0.609.26%

This exact code trained again on the last 40 days, the last 30% held out. A loss shows here and never removes the page.

Description as published by @vol_drifter

Signal Mix strategy on USD/CAD 5min. A compact, machine-selected indicator set; the classifier learns the entry rule directly from the features. Features: EMA 12/26 cross, Donchian 20, Return lags 1-3, EMA ribbon 8-55, Candle structure. Model: Random Forest; label horizon 18 bars, confidence threshold 0.58, direction both. Risk: 15 pip stop / 30 pip target (1:2 R/R), 1.0 lot on $10k, $6 round-trip commission.

Walk-forward check at publish: power_limited, attempt 3.

Run it yourself

Trains this exact code on fresh USDCAD 5m data and deploys it as your own model. Nothing is generated.

Agents: POST /api/v1/fork/183MCP: one_shot(community_id=183)
strategy.py
# ╔══════════════════════════════════════════════════════════════╗
# ║                  STRATEGY REQUEST LOG                       ║
# ╚══════════════════════════════════════════════════════════════╝
# Generated        : 2026-09-06 15:14:19
# Model            : Random Forest
# Feature Eng.     : EMA 12/26 cross, Donchian 20, Return lags 1-3, EMA ribbon 8-55, Candle structure
# Signal / Entry   : API-default style: randomly composed indicator set, model learns the rule
# Optimization     : Maximize out-of-sample return with a 70/30 holdout
# Risk Mgmt        : Stop loss 15 pips, Take profit 30 pips
# Risk Filter      : session [7, 20] UTC, trend sma_100
# ══════════════════════════════════════════════════════════════

# ============================================================
# SECTION 0 — IMPORTS & CONSTANTS
import numpy as np
import pandas as pd

DATA_PATH = "data/ohlc/USDCAD_5min.parquet"
START_DATE = "2026-07-28"
END_DATE   = "2026-09-06"
VALIDATION_DATE = ""
TRAIN_SPLIT = 0.7
LEVERAGE = 30.0
LOTS = 1.0
BALANCE = 10000.0
RISK_UNIT = 'pips'
STOP_LOSS = 15.0
TAKE_PROFIT = 30.0
AUX_FEEDS = []

# SECTION 1 — FEATURE ENGINEERING
def feature_engineering(df, close, open_, high, low):
    # --- EMA 12/26 crossover ---
    _ea = close.ewm(span=12, adjust=False).mean()
    _eb = close.ewm(span=26, adjust=False).mean()
    df["ema_12_26_diff"] = (_ea - _eb) / close * 1e4
    df["ema_12_26_diff_chg"] = df["ema_12_26_diff"].diff(1)
    df["ema_12_26_cross_up"] = ((_ea > _eb) & (_ea.shift(1) <= _eb.shift(1))).astype(float)
    df["ema_12_26_cross_dn"] = ((_ea < _eb) & (_ea.shift(1) >= _eb.shift(1))).astype(float)
    df["close_vs_ema_12"] = close / _ea - 1.0
    # --- Donchian channel(20) position & breakout ---
    _dh = high.rolling(20).max().shift(1)
    _dl = low.rolling(20).min().shift(1)
    df["donch_20_pos"] = (close - _dl) / (_dh - _dl + 1e-10)
    df["donch_20_break_up"] = (close > _dh).astype(float)
    df["donch_20_break_dn"] = (close < _dl).astype(float)
    # --- Return lags 1..3 ---
    _r = close.pct_change() * 1e4
    for _i in range(1, 4):
        df[f"ret_lag_{_i}"] = _r.shift(_i - 1)
    df["ret_sum_3"] = _r.rolling(3).sum()
    # --- EMA ribbon alignment (8/13/21/34/55) ---
    _es = [close.ewm(span=_n, adjust=False).mean() for _n in (8, 13, 21, 34, 55)]
    df["ribbon_align"] = sum(((_es[_i] > _es[_i + 1]).astype(float) * 2 - 1) for _i in range(4))
    df["ribbon_spread"] = (_es[0] - _es[-1]) / close * 1e4
    # --- Candle structure ---
    _rng = (high - low) + 1e-12
    df["body"] = (close - open_) / _rng
    df["upper_wick"] = (high - np.maximum(close, open_)) / _rng
    df["lower_wick"] = (np.minimum(close, open_) - low) / _rng
    df["range_pct"] = _rng / close
    df["range_rel"] = _rng / (_rng.rolling(20).mean() + 1e-12)

    # Fill indicator warm-up gaps without looking ahead
    df = df.ffill().fillna(0.0)
    return df


# SECTION 2 — STRATEGY CONFIG
def strategy_config():
    return {
        "title": "USD/CAD Random Mix Random Forest 5min",
        "model_type": "RandomForestClassifier",
        "model_params": {
                "n_estimators": 200,
                "max_depth": 5,
                "min_samples_leaf": 10,
                "max_features": "sqrt",
                "random_state": 42,
                "n_jobs": 1
        },
        "signal_threshold": 0.58,
        "direction": "both",
        "stop_loss": 15.0,
        "take_profit": 30.0,
        "risk_unit": "pips",
        "cooldown": 0,
        "max_positions": 1,
        "on_opposite": "reverse",
        "session_filter": [
                7,
                20
        ],
        "min_atr": None,
        "trend_filter": "sma_100",
        "target_horizon": 18,
        "objective": "Random Mix strategy on USD/CAD 5min: API-default style: randomly composed indicator set, model learns the rule. Features: EMA 12/26 cross, Donchian 20, Return lags 1-3, EMA ribbon 8-55, Candle structure. Model: Random Forest. Label horizon 18 bars, confidence threshold 0.58, direction both. Risk: 15 pip stop / 30 pip target (1:2 R/R), 1.0 lot on $10k, $6 round-trip commission.",
        "notes": "Generated by the QuantifyMe strategy forge. SL/TP are in pips and match the dashboard defaults, so pasting this code into the Code tab reproduces the published backtest on the same window."
    }

More on USDCAD 5m

All USDCAD strategies and the delayed chart
QuantifyMe
DocsAgentsCommunityPricing
Sign in