Rule backtester
Pick a series to trade, a signal and simple entry and exit rules. Everything runs in your browser on official data; the rule is in the URL, so a result can be shared.
Pick a series to trade, a signal and simple entry and exit rules. Everything runs in your browser on official data; the rule is in the URL, so a result can be shared.
When US distillate stocks are more than 5% below their five-year norm for the week (as published, five days after the week ends), bet on a firmer diesel crack; exit when stocks are back at normal.
In-sample research, not a trading recommendation.
The rule is tested on the same history it may have been tuned on: judge it on the control period (after 20 Aug 2020), which you should not have used to choose the settings. P&L is the change of the NY Harbor diesel crack vs Brent while the rule is in a position, in $/bbl — a spot spread is a measure of the signal, not an instrument you can hold. 45 trades in 20.4 years.
| Period | Trades | Total P&L ($/bbl) | Hit rate | Avg win / loss | Sharpe | Max drawdown | In position | Trades / year |
|---|---|---|---|---|---|---|---|---|
| Tuning period (first 70%) | 22 | −16.89 | 36% | +4.83 / −3.97 | −0.09 | −31.95 | 35% | 1.6 |
| Control period (last 30%) | 23 | +48.34 | 48% | +13.02 / −7.90 | 0.14 | −103.21 | 86% | 3.7 |
| Whole history | 45 | +31.45 | 42% | +9.57 / −5.79 | 0.05 | −103.21 | 50% | 2.2 |
* Fewer than 20 trades: the Sharpe ratio is not meaningful. Sharpe is computed on daily P&L in $/bbl, annualised with the series' observations per year.
| Cost per round trip | Total P&L ($/bbl) | Sharpe |
|---|---|---|
| 0× the stated cost | +44.95 | 0.07 |
| 1× the stated cost | +31.45 | 0.05 |
| 2× the stated cost | +17.95 | 0.03 |
| 4× the stated cost | −9.05 | −0.01 |
| Entry | Exit | Entry level | Exit level | P&L ($/bbl) | Why it closed |
|---|---|---|---|---|---|
| 25 Sept 2008 | 13 Nov 2008 | 32.02 | 31.84 | −0.48 | signal |
| 10 Nov 2011 | 12 Jan 2012 | 19.95 | 16.14 | −4.11 | signal |
| 3 May 2012 | 1 Aug 2012 | 17.15 | 17.33 | −0.12 | max hold |
| 2 Aug 2012 | 30 Oct 2012 | 16.73 | 23.49 | +6.46 | max hold |
| 31 Oct 2012 | 30 Jan 2013 | 22.62 | 17.80 | −5.12 | max hold |
| 31 Jan 2013 | 30 Apr 2013 | 18.05 | 18.30 | −0.06 | max hold |
| 1 May 2013 | 29 Jul 2013 | 19.22 | 18.91 | −0.61 | max hold |
| 30 Jul 2013 | 24 Oct 2013 | 19.03 | 15.34 | −4.00 | max hold |
| 25 Oct 2013 | 24 Jan 2014 | 16.90 | 33.66 | +16.46 | max hold |
| 27 Jan 2014 | 24 Apr 2014 | 32.99 | 16.84 | −16.45 | max hold |
| 25 Apr 2014 | 23 Jul 2014 | 15.84 | 13.90 | −2.24 | max hold |
| 24 Jul 2014 | 23 Oct 2014 | 14.80 | 19.02 | +3.92 | max hold |
| 24 Oct 2014 | 23 Jan 2015 | 18.45 | 22.40 | +3.65 | max hold |
| 26 Jan 2015 | 23 Apr 2015 | 22.89 | 18.23 | −4.96 | max hold |
| 19 Apr 2018 | 17 Jul 2018 | 14.19 | 15.94 | +1.45 | max hold |
| 18 Jul 2018 | 12 Oct 2018 | 17.39 | 17.02 | −0.66 | max hold |
| 8 Nov 2018 | 12 Feb 2019 | 21.89 | 17.43 | −4.76 | max hold |
| 4 Apr 2019 | 1 Jul 2019 | 14.70 | 16.80 | +1.80 | max hold |
| 2 Jul 2019 | 25 Sept 2019 | 16.74 | 19.74 | +2.70 | max hold |
| 26 Sept 2019 | 20 Dec 2019 | 20.07 | 16.14 | −4.23 | max hold |
| 23 Dec 2019 | 23 Mar 2020 | 17.39 | 19.93 | +2.24 | max hold |
| 24 Mar 2020 | 30 Apr 2020 | 21.15 | 13.68 | −7.77 | signal |
| 11 Mar 2021 | 25 Mar 2021 | 12.94 | 12.12 | −1.12 | signal |
| 27 May 2021 | 24 Aug 2021 | 17.05 | 15.56 | −1.79 | max hold |
| 25 Aug 2021 | 22 Nov 2021 | 16.63 | 16.60 | −0.33 | max hold |
| 23 Nov 2021 | 25 Feb 2022 | 17.12 | 22.06 | +4.65 | max hold |
| 28 Feb 2022 | 27 May 2022 | 23.38 | 47.73 | +24.05 | max hold |
| 31 May 2022 | 30 Aug 2022 | 42.22 | 60.97 | +18.46 | max hold |
| 31 Aug 2022 | 2 Dec 2022 | 58.93 | 47.86 | −11.37 | max hold |
| 5 Dec 2022 | 9 Mar 2023 | 43.40 | 31.94 | −11.76 | max hold |
| 10 Mar 2023 | 12 Jun 2023 | 34.92 | 25.89 | −9.33 | max hold |
| 13 Jun 2023 | 12 Sept 2023 | 26.90 | 47.25 | +20.05 | max hold |
| 13 Sept 2023 | 11 Dec 2023 | 51.99 | 35.21 | −17.07 | max hold |
| 12 Dec 2023 | 14 Mar 2024 | 30.97 | 27.58 | −3.70 | max hold |
| 15 Mar 2024 | 17 Jun 2024 | 28.93 | 21.12 | −8.11 | max hold |
| 18 Jun 2024 | 17 Sept 2024 | 20.50 | 14.41 | −6.40 | max hold |
| 18 Sept 2024 | 13 Dec 2024 | 14.06 | 19.53 | +5.17 | max hold |
| 19 Dec 2024 | 24 Mar 2025 | 18.90 | 21.21 | +2.01 | max hold |
| 25 Mar 2025 | 25 Jun 2025 | 22.65 | 28.96 | +6.00 | max hold |
| 26 Jun 2025 | 24 Sept 2025 | 31.77 | 32.17 | +0.10 | max hold |
| 25 Sept 2025 | 24 Dec 2025 | 33.60 | 29.20 | −4.69 | max hold |
| 2 Jan 2026 | 29 Jan 2026 | 27.06 | 32.03 | +4.67 | signal |
| 19 Feb 2026 | 20 May 2026 | 38.42 | 60.58 | +21.86 | max hold |
| 21 May 2026 | 19 Aug 2026 | 61.07 | 97.55 | +36.19 | max hold |
| 20 Aug 2026 | 17 Nov 2026 | 97.86 | 78.97 | −19.19 | max hold |