
Free first chapter
Predictive Models and Automation for the 24/5 Currency Market
Read the first chapter in your browser. It's free, with no account and no email needed.
Free to read. No account required.
Currency markets do not behave like equities or crypto. They run twenty-four hours a day, five days a week, shift character from one trading session to the next, and react sharply to macro events. A generic machine learning model pointed at a currency pair often ignores all of that.
Forex Machine Learning is written for readers who already know Python and basic ML and want a workflow built for FX. The first part lays out the global FX substrate: sessions, macro events, and the structure that makes this market distinctive. The second builds predictive models and cross-currency features on top of it, including regime detection, conviction calibration, and sequence modeling. The third connects those models to execution support, leverage control, hedging logic, and operational continuity.
A session-aware FX research and automation stack that combines multi-pair data, regime logic, model predictions, and risk-controlled execution planning.
This book is for readers who want serious FX workflows rather than generic ML systems pointed at currency pairs. It assumes you already have working Python and basic ML skills — if you have read The ML Trading Bible, you are ready. Read linearly on the first pass because session structure, event risk, and execution constraints all shape the modeling choices that come later.
Every chapter builds on the one before it. Chapter 1 defines the FX substrate — sessions, macro events, and the 24/5 structure that makes currencies behave differently from equities and crypto. Chapter 2 builds predictive models and cross-currency features on top of that substrate, including regime detection and conviction calibration. Chapter 3 connects the resulting system to execution support, leverage control, hedging logic, and operational continuity.
If any of these are unfamiliar, start with The ML Trading Bible first.
Use a Python environment with the following core libraries:
Keep multi-pair datasets, macro calendars, session definitions, feature-generation logic, and validation reports organized so every result can be tied back to the exact time, session, and market context in which it was produced.
Work through examples and exercises — do not skip them. The details of timing, session boundaries, and risk handling are where most FX systems fail, and the exercises are designed to surface those failure modes before you encounter them with real capital.
A quantitative researcher builds a gradient-boosted model that predicts EUR/USD returns at the hourly frequency. The model trains on three years of data, uses standard technical features — moving averages, RSI, Bollinger Band width — and produces a Sharpe ratio of 1.8 in walk-forward validation. He deploys it. Within two weeks, the model's live performance has collapsed. The equity curve goes flat during Asian hours, spikes erratically around 8:30 AM Eastern on the first Friday of each month, and gives back most of its gains during a single Wednesday afternoon when the Federal Reserve changes its rate guidance by twelve words.
The model was not broken. The features were not miscalculated. The problem was structural: the researcher treated EUR/USD as a single continuous time series with uniform statistical properties, when in reality it is a composite of at least four distinct regimes that rotate every few hours, punctuated by macro events that temporarily rewrite the rules of price formation. A moving average computed across the Tokyo session close and the London session open blends two populations with different volatility, different participants, and different information flows. The model learned patterns that exist only within sessions, but the features destroyed the session boundaries that made those patterns meaningful.
This chapter builds the foundation that prevents that failure. Before you train a single model on currency data, you need to understand what makes FX structurally different from equities, crypto, and futures — and how those differences must be encoded into every feature, every label, and every evaluation window. The substrate is not the model. It is the surface on which the model stands. If the surface is uneven and you pretend it is flat, the model will fall over. Everything in the remaining chapters of this book depends on the substrate being built correctly here.
Foreign exchange is the largest financial market on the planet by daily turnover. The Bank for International Settlements Triennial Survey consistently reports daily volumes exceeding $7 trillion, dwarfing global equity markets by a factor of roughly twenty. But size is not what makes FX different for machine learning practitioners. Three structural properties set it apart: continuity, fragmentation, and macro sensitivity. Each one has direct consequences for how you build features, define labels, and validate models.
Equity markets open and close. The New York Stock Exchange runs from 9:30 AM to 4:00 PM Eastern, five days a week. When it closes, the data stops. This creates natural boundaries — an overnight gap, a defined session — that ML pipelines can use as structural anchors.
FX does not close. From Sunday evening in Wellington to Friday afternoon in New York, the market is continuously quoted. There is no official opening bell. There is no closing auction. The consequence for ML is profound: every feature that relies on a "close" price is making an arbitrary choice about when that close occurs. A 1-hour bar at 3:00 PM London time and a 1-hour bar at 3:00 AM London time share the same candlestick format but describe fundamentally different market conditions. The first captures peak liquidity during the London-New York overlap. The second captures thin Asian liquidity with different participants and different volatility characteristics.
The practitioner who treats every bar identically is pooling distributions that should not be pooled. A volatility feature computed without regard to session context will systematically overestimate volatility during quiet hours (because the lookback includes London bars) and underestimate it during active hours (because the lookback includes Tokyo bars). This is not a theoretical concern — it is a measurable bias that degrades every model built on top of it.
Equities trade on exchanges with consolidated tape. FX trades over the counter, across a fragmented network of banks, electronic communication networks (ECNs), and retail brokers. There is no single "true" price for EUR/USD at any moment. The price your broker quotes may differ from the price on EBS, which may differ from the price on Reuters Matching, which may differ from the price a tier-one bank quotes to its institutional clients.
For ML, fragmentation means that your data source matters more than you think. Two researchers using data from different providers will see slightly different prices, slightly different spreads, and slightly different timestamps. A model trained on one feed may not transfer to another. Spread dynamics, which matter enormously for execution cost modeling, vary by provider and by time of day. A model that ignores spread as a feature is ignoring a signal that is both predictive and structurally important.
Currency markets do not behave like equities or crypto.
Free to read. No account required.