Skip to the page

EUR/USD Signal Mix: MACD (5,13,3) (Random Forest, 1h)

EURUSD 1h, published 9 Sep 2026 by @delta_one. Community id 301.

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

Out-of-sample result at publish, frozen

+11.20%

TradesWin rateProfit factorMax drawdown
1275.0%3.674.00%

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 23 Nov 2026

−6.01%

TradesWin rateProfit factorMax drawdown
1338.5%0.616.01%

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 @delta_one

Random Mix strategy on EUR/USD 1h: API-default style: randomly composed indicator set, model learns the rule. Features: Session/time features, MACD (5,13,3), CCI 14, Keltner (20,2.0). Model: Random Forest. Label horizon 2 bars, confidence threshold 0.55, direction both. Risk: 25 pip stop / 50 pip target (1:2 R/R), 1.0 lot on $10k, $6 round-trip commission.

Walk-forward check at publish: noise, attempt 2.

Run it yourself

Trains this exact code on fresh EURUSD 1h data and deploys it as your own model. Nothing is generated.

Agents: POST /api/v1/fork/301MCP: one_shot(community_id=301)
strategy.py
# ╔══════════════════════════════════════════════════════════════╗
# ║                  STRATEGY REQUEST LOG                       ║
# ╚══════════════════════════════════════════════════════════════╝
# Generated        : 2026-09-09 01:34:17
# Model            : Random Forest
# Feature Eng.     : Session/time features, MACD (5,13,3), CCI 14, Keltner (20,2.0)
# 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 25 pips, Take profit 50 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/EURUSD_1h.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 = 25.0
TAKE_PROFIT = 50.0
AUX_FEEDS = []

# SECTION 1 — FEATURE ENGINEERING
def feature_engineering(df, close, open_, high, low):
    # --- Time-of-day / day-of-week (UTC) ---
    _h = df.index.hour + df.index.minute / 60.0
    df["hour_sin"] = np.sin(2 * np.pi * _h / 24.0)
    df["hour_cos"] = np.cos(2 * np.pi * _h / 24.0)
    df["dow"] = df.index.dayofweek.astype(float)
    df["london_open"] = ((df.index.hour >= 7) & (df.index.hour < 10)).astype(float)
    df["ny_open"] = ((df.index.hour >= 13) & (df.index.hour < 16)).astype(float)
    # --- MACD(5,13,3) ---
    _m = close.ewm(span=5, adjust=False).mean() - close.ewm(span=13, adjust=False).mean()
    _sig = _m.ewm(span=3, adjust=False).mean()
    df["macd_5_13"] = _m / close * 1e4
    df["macd_5_13_sig"] = _sig / close * 1e4
    df["macd_5_13_hist"] = (_m - _sig) / close * 1e4
    df["macd_5_13_hist_chg"] = df["macd_5_13_hist"].diff(1)
    # --- CCI(14) ---
    _tp = (high + low + close) / 3.0
    _tpm = _tp.rolling(14).mean()
    _md = (_tp - _tpm).abs().rolling(14).mean()
    df["cci_14"] = (_tp - _tpm) / (0.015 * _md + 1e-12)
    # --- Keltner channel(20,2.0) position ---
    _kmid = close.ewm(span=20, adjust=False).mean()
    _ktr = pd.concat([high - low, (high - close.shift(1)).abs(), (low - close.shift(1)).abs()], axis=1).max(axis=1)
    _katr = _ktr.ewm(alpha=1.0/20, adjust=False).mean()
    df["kelt_20_pos"] = (close - _kmid) / (2.0 * _katr + 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": "EUR/USD Random Mix Random Forest 1h",
        "model_type": "RandomForestClassifier",
        "model_params": {
                "n_estimators": 200,
                "max_depth": 5,
                "min_samples_leaf": 20,
                "max_features": "sqrt",
                "random_state": 42,
                "n_jobs": 1
        },
        "signal_threshold": 0.55,
        "direction": "both",
        "stop_loss": 25.0,
        "take_profit": 50.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": 2,
        "objective": "Random Mix strategy on EUR/USD 1h: API-default style: randomly composed indicator set, model learns the rule. Features: Session/time features, MACD (5,13,3), CCI 14, Keltner (20,2.0). Model: Random Forest. Label horizon 2 bars, confidence threshold 0.55, direction both. Risk: 25 pip stop / 50 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 EURUSD 1h

All EURUSD strategies and the delayed chart
QuantifyMe
DocsAgentsCommunityPricing
Sign in