Mock data
Backtest
See how a strategy would have done over past prices, compared with a simple benchmark. Past results don't predict future ones.
Settings
Test a range of settings
Runs the backtest for every combination (up to 200) and shows the results side by side.
Pick a strategy with numbers to vary (like the moving averages' lengths) in Settings, and sweep them here.
Saved runs
For this browserResults
Choose your settings and run a backtest to see how the strategy would have done.
Pairs trading Pairs trading and cointegrationTrading the gap between two linked stocks: when it stretches far from normal, buy the one that lagged and short the one that ran ahead, betting the gap comes back.It only makes sense if the pair is cointegrated: a fixed mix of the two keeps returning to its average, which is more than moving together day to day. Test hundreds of pairs and some will look cointegrated by chance, so the results need adjusting for how many were tried.Full lesson →
Find two stocks from the same sector whose prices keep a steady relationship, then trade the gap when it stretches: buy the cheap side, sell the dear one short, and close when the gap comes back.
On simulated prices, stocks only share the market's and their sector's moves, so a lasting relationship between two of them is rare. Expect few or no pairs to survive: that's the honest answer, not a fault.
Pairs found
Choose a formation year and find pairs. Every same-sector pair of MarketLab's stocks is tested.
Train a model
Machine learning in tradingModels that learn patterns from data, such as recent returns and indicators, to predict what a price does next.A model is shown features and what happened afterward, and learns a rule. Markets are mostly noise, so the honest test is whether it beats a lucky guess on data it never trained on, after trading costs. Most models don't.Full lesson →Predict whether each stock will rise over the next week, from what was known that day. Tested only on data the model never saw.
Out-of-sample results
Choose stocks, features and a model, then train and test.