Skip to the page

USD/CAD Signal Mix: ADX 14 + BB (10,2.0) (LightGBM, 5m)

USDCAD 5m, published 9 Sep 2026 by @rapid-shark-854. Community id 281.

The latest daily re-run lost money: −7.08% over 50 trades. At publish it made +14.32% over 31 trades. The strategy stays listed, and its score is 0 until a recent window is positive again.

Out-of-sample result at publish, frozen

+14.32%

TradesWin rateProfit factorMax drawdown
3148.4%2.283.58%

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

−7.08%

TradesWin rateProfit factorMax drawdown
5028.0%0.7214.00%

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 @rapid-shark-854

Random Mix strategy on USD/CAD 5min: API-default style: randomly composed indicator set, model learns the rule. Features: ADX 14, Return lags 1-8, BB (10,2.0), ATR 14, Volatility 50. Model: LightGBM. Label horizon 6 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: noise, attempt 1.

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/281MCP: one_shot(community_id=281)
strategy.py
# ╔══════════════════════════════════════════════════════════════╗
# ║                  STRATEGY REQUEST LOG                       ║
# ╚══════════════════════════════════════════════════════════════╝
# Generated        : 2026-09-09 01:03:13
# Model            : LightGBM
# Feature Eng.     : ADX 14, Return lags 1-8, BB (10,2.0), ATR 14, Volatility 50
# 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, 17] 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-31"
END_DATE   = "2026-09-09"
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):
    # --- ADX(14) with +DI/-DI ---
    _up = high.diff()
    _dn = -low.diff()
    _pdm = pd.Series(np.where((_up > _dn) & (_up > 0), _up, 0.0), index=df.index)
    _ndm = pd.Series(np.where((_dn > _up) & (_dn > 0), _dn, 0.0), index=df.index)
    _tr2 = pd.concat([high - low, (high - close.shift(1)).abs(), (low - close.shift(1)).abs()], axis=1).max(axis=1)
    _atr2 = _tr2.ewm(alpha=1.0/14, adjust=False).mean()
    _pdi = 100.0 * _pdm.ewm(alpha=1.0/14, adjust=False).mean() / (_atr2 + 1e-12)
    _ndi = 100.0 * _ndm.ewm(alpha=1.0/14, adjust=False).mean() / (_atr2 + 1e-12)
    _dx = 100.0 * (_pdi - _ndi).abs() / (_pdi + _ndi + 1e-12)
    df["adx_14"] = _dx.ewm(alpha=1.0/14, adjust=False).mean()
    df["di_diff_14"] = _pdi - _ndi
    # --- Return lags 1..8 ---
    _r = close.pct_change() * 1e4
    for _i in range(1, 9):
        df[f"ret_lag_{_i}"] = _r.shift(_i - 1)
    df["ret_sum_8"] = _r.rolling(8).sum()
    # --- Bollinger Bands(10,2.0) ---
    _mid = close.rolling(10).mean()
    _sd = close.rolling(10).std()
    df["bb_10_2p0_pctb"] = (close - (_mid - 2.0 * _sd)) / (2 * 2.0 * _sd + 1e-10)
    df["bb_10_2p0_width"] = (2 * 2.0 * _sd) / (_mid + 1e-10)
    df["bb_10_2p0_width_chg"] = df["bb_10_2p0_width"].pct_change(3)
    # --- ATR(14) normalised ---
    _tr = pd.concat([high - low, (high - close.shift(1)).abs(), (low - close.shift(1)).abs()], axis=1).max(axis=1)
    _atr = _tr.ewm(alpha=1.0/14, adjust=False).mean()
    df["atr_14_pct"] = _atr / close
    df["atr_14_ratio"] = _atr / (_atr.rolling(56).mean() + 1e-12)
    # --- Realised volatility(50) ---
    _r2 = close.pct_change()
    df["vol_50"] = _r2.rolling(50).std() * 1e4
    df["vol_50_ratio"] = df["vol_50"] / (_r2.rolling(200).std() * 1e4 + 1e-9)

    # 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 LightGBM 5min",
        "model_type": "LGBMClassifier",
        "model_params": {
                "n_estimators": 200,
                "num_leaves": 31,
                "learning_rate": 0.05,
                "subsample": 0.8,
                "subsample_freq": 1,
                "colsample_bytree": 0.8,
                "min_child_samples": 40,
                "reg_lambda": 1.0,
                "random_state": 42,
                "n_jobs": 1,
                "verbose": -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,
                17
        ],
        "min_atr": None,
        "trend_filter": "sma_100",
        "target_horizon": 6,
        "objective": "Random Mix strategy on USD/CAD 5min: API-default style: randomly composed indicator set, model learns the rule. Features: ADX 14, Return lags 1-8, BB (10,2.0), ATR 14, Volatility 50. Model: LightGBM. Label horizon 6 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