Skip to the page

NZD/USD Vol-Regime: BB + ATR 14 (GradBoost, 1h)

NZDUSD 1h, published 6 Sep 2026 by @pivot_kid. Community id 245.

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

Out-of-sample result at publish, frozen

+5.80%

TradesWin rateProfit factorMax drawdown
1952.6%1.688.24%

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

−0.55%

TradesWin rateProfit factorMax drawdown
1942.1%0.974.94%

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

Vol-Regime strategy on NZD/USD 1h. Squeeze (Bollinger inside Keltner) then expansion; the classifier picks the direction of the release. Features: BB (20,2.0), ATR 14, ADX 14, Volatility 20, Return lags 1-3, Keltner (20,1.5), Session/time features. Model: Gradient Boosting; label horizon 3 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 1.

Run it yourself

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

Agents: POST /api/v1/fork/245MCP: one_shot(community_id=245)
strategy.py
# ╔══════════════════════════════════════════════════════════════╗
# ║                  STRATEGY REQUEST LOG                       ║
# ╚══════════════════════════════════════════════════════════════╝
# Generated        : 2026-09-06 15:33:05
# Model            : Gradient Boosting
# Feature Eng.     : BB (20,2.0), ATR 14, ADX 14, Volatility 20, Return lags 1-3, Keltner (20,1.5), Session/time features
# Signal / Entry   : Squeeze (BB inside Keltner) then expansion; classifier picks the direction of the release
# Optimization     : Maximize out-of-sample return with a 70/30 holdout
# Risk Mgmt        : Stop loss 25 pips, Take profit 50 pips
# Risk Filter      : session [12, 21] UTC
# ══════════════════════════════════════════════════════════════

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

DATA_PATH = "data/ohlc/NZDUSD_1h.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 = 25.0
TAKE_PROFIT = 50.0
AUX_FEEDS = []

# SECTION 1 — FEATURE ENGINEERING
def feature_engineering(df, close, open_, high, low):
    # --- Bollinger Bands(20,2.0) ---
    _mid = close.rolling(20).mean()
    _sd = close.rolling(20).std()
    df["bb_20_2p0_pctb"] = (close - (_mid - 2.0 * _sd)) / (2 * 2.0 * _sd + 1e-10)
    df["bb_20_2p0_width"] = (2 * 2.0 * _sd) / (_mid + 1e-10)
    df["bb_20_2p0_width_chg"] = df["bb_20_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)
    # --- 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
    # --- Realised volatility(20) ---
    _r2 = close.pct_change()
    df["vol_20"] = _r2.rolling(20).std() * 1e4
    df["vol_20_ratio"] = df["vol_20"] / (_r2.rolling(80).std() * 1e4 + 1e-9)
    # --- 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()
    # --- Keltner channel(20,1.5) 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) / (1.5 * _katr + 1e-12)
    # --- 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)

    # 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": "NZD/USD Vol-Regime Gradient Boosting 1h",
        "model_type": "GradientBoostingClassifier",
        "model_params": {
                "n_estimators": 200,
                "max_depth": 2,
                "learning_rate": 0.1,
                "subsample": 0.7,
                "random_state": 42
        },
        "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": [
                12,
                21
        ],
        "min_atr": None,
        "trend_filter": None,
        "target_horizon": 3,
        "objective": "Vol-Regime strategy on NZD/USD 1h: Squeeze (BB inside Keltner) then expansion; classifier picks the direction of the release. Features: BB (20,2.0), ATR 14, ADX 14, Volatility 20, Return lags 1-3, Keltner (20,1.5), Session/time features. Model: Gradient Boosting. Label horizon 3 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 NZDUSD 1h

No other strategy on NZDUSD 1h passes the quality bar yet.

All NZDUSD strategies and the delayed chart
QuantifyMe
DocsAgentsCommunityPricing
Sign in