ML-Ready Forex Datasets — Triple-Barrier Labels, Next-Bar Direction & Time Splits
Clean OHLC, precomputed features, triple-barrier labels, next-bar direction, time-based train/validation/test splits and a feature dictionary. Built for pandas, Polars, DuckDB, scikit-learn, XGBoost and PyTorch.
Available ML-Ready Datasets
Each file includes features, labels and a split column. Downloads are email-gated. Parquet is recommended for Python training.
Label Definitions
+1 Upper barrier
Price hits entry + 1.5× ATR(14) before the lower barrier or time barrier.
-1 Lower barrier
Price hits entry − 1.5× ATR(14) before the upper barrier or time barrier.
0 Time barrier
Neither price barrier is hit within 12 bars; the label is neutral.
Feature Dictionary & Leakage Rules
The feature dictionary lists every column, its type, a description and whether it is a feature, label or metadata. All feature columns are causal. Labels use future bars by design. Descriptive pivot columns were removed from the ML files to prevent accidental leakage.
| Group | Columns |
|---|---|
| Price | Timestamp, Open, High, Low, Close, TickVolume, Spread |
| Returns | return_1, log_return_1, body, range, upper_wick, lower_wick |
| Trend | ema_9, ema_13, ema_34, ema_50, ema_200 |
| Oscillators | rsi_14, stoch_k_3_2_1, stoch_d_3_2_1, macd_6_13_4, macd_signal_6_13_4, macd_hist_6_13_4 |
| Volatility | atr_14, bb_mid_20, bb_upper_20_2, bb_lower_20_2, bb_width, volatility_regime |
| Trend strength | adx_14, di_plus_14, di_minus_14 |
| Context | vwap_session, session, hour, day_of_week, high_10_break, low_10_break |
| Labels | tb_label, tb_bars, tb_return, next_bar_direction, next_bar_return |
| Split | train, validation, test |
Minimal Python Example
import pandas as pd
df = pd.read_parquet("XAUUSD_M15_ml_ready.parquet")
features = [c for c in df.columns if c not in {
"Timestamp", "tb_label", "tb_bars", "tb_return",
"next_bar_direction", "next_bar_return", "split"
}]
train = df[df.split == "train"]
valid = df[df.split == "validation"]
test = df[df.split == "test"]
X_train, y_train = train[features], train["tb_label"]
X_valid, y_valid = valid[features], valid["tb_label"]
X_test, y_test = test[features], test["tb_label"]
Encode session and volatility_regime before fitting. Drop warm-up rows with empty indicators. Do not shuffle time-series rows before splitting.
ML-Ready Dataset FAQ
What is triple-barrier labeling?
Triple-barrier labeling sets an upper barrier, a lower barrier and a time barrier. The label is +1 if the upper barrier is hit first, -1 if the lower barrier is hit first, and 0 if the time barrier is reached first.
How are the barriers calculated?
The upper and lower barriers are 1.5 times the 14-bar ATR from the entry close. The time barrier is 12 bars.
How are train, validation and test split?
The split is time-based: the first 70% of rows are train, the next 15% are validation and the final 15% are test. No random shuffling is used.
Does the dataset contain lookahead leakage?
The feature columns are causal. The labels use future bars by design. Pivot high and pivot low columns were removed to avoid accidental feature leakage.
Related Data & Tools
Choose the next useful step
Most visitors arrive with one question: build, test, price, or trust. These shortcuts keep the path practical.
Go deeper before you build, download or automate
Hand-picked engineering articles, indicator breakdowns and trading-system tools so visitors keep exploring instead of leaving after one page.
Pine Script to MT4/MT5 Conversion Planner
Analyze Pine strategies, repainting risk, TradingView alert bridges, MTF synchronization and the correct MQL4/MQL5 build path before paying for conversion.
Open planner
3-in-1 MT5 Indicator Bundle
12H Bias Engine, Smart Money Institutional Flow Dashboard and D1/H1 pending-signal logic with MQ5 + EX5 source included via Etsy.
MT5 Bank Orders Institutional Flow Dashboard
Supply/demand zones, BOS/CHoCH, liquidity levels, FVG, equal highs/lows and confirmed trade-plan logic explained with EX5 download.
MT5 Asia London NY Liquidity Engine
Asia range, London raid and New York continuation/reversal planning with internal session backtest stats and entry/SL/TP dashboard.
Interactive Brokers RSI Pair Trader
Tkinter desktop trading workflow, TWS API connection handling, RSI pair logic, risk controls and custom IBKR development positioning.
XAUUSD M30 CSV Data For Backtesting
Use clean MT5 historical data for Python backtests, strategy validation, spread checks and realistic gold EA research workflows.