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 the refining margin is in the bottom 10% of the last three years, bet on recovery; exit when it is back above its median.
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 16 Sept 2020), which you should not have used to choose the settings. P&L is the change of the US Gulf Coast 3-2-1 crack while the rule is in a position, in $/bbl — a spot spread is a measure of the signal, not an instrument you can hold. 18 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%) | 13 | +44.24 | 85% | +4.29 / −1.54 | 0.14* | −60.19 | 24% | 0.9 |
| Control period (last 30%) | 5 | +42.45 | 100% | +8.51 / — | 0.80* | −11.48 | 25% | 0.8 |
| Whole history | 18 | +86.69 | 89% | +5.61 / −1.54 | 0.22* | −60.19 | 24% | 0.9 |
* 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 | +90.29 | 0.23 |
| 1× the stated cost | +86.69 | 0.22 |
| 2× the stated cost | +83.09 | 0.21 |
| 4× the stated cost | +75.89 | 0.19 |
| Entry | Exit | Entry level | Exit level | P&L ($/bbl) | Why it closed |
|---|---|---|---|---|---|
| 2 Jul 2009 | 24 Jul 2009 | 4.89 | 10.21 | +5.12 | signal |
| 27 Aug 2009 | 23 Feb 2010 | 5.91 | 7.20 | +1.09 | max hold |
| 6 Sept 2013 | 3 Mar 2014 | 8.76 | 15.59 | +6.63 | max hold |
| 27 Mar 2014 | 18 Sept 2014 | 15.69 | 17.78 | +1.89 | max hold |
| 9 Oct 2014 | 11 Feb 2015 | 10.42 | 19.46 | +8.84 | signal |
| 12 Oct 2015 | 1 Apr 2016 | 9.30 | 14.07 | +4.57 | max hold |
| 14 Nov 2016 | 7 Dec 2016 | 8.06 | 12.67 | +4.41 | signal |
| 1 Mar 2018 | 15 Mar 2018 | 13.86 | 15.56 | +1.50 | signal |
| 27 Jun 2018 | 2 Jul 2018 | 9.39 | 12.84 | +3.25 | signal |
| 9 Jan 2019 | 15 Feb 2019 | 11.09 | 16.34 | +5.05 | signal |
| 21 Feb 2019 | 4 Mar 2019 | 11.61 | 16.68 | +4.87 | signal |
| 3 Dec 2019 | 21 Apr 2020 | 12.03 | 11.49 | −0.74 | signal |
| 22 Apr 2020 | 13 Oct 2020 | 10.65 | 8.52 | −2.33 | max hold |
| 15 Oct 2020 | 22 Feb 2021 | 7.82 | 14.13 | +6.10 | signal |
| 6 Dec 2023 | 7 Feb 2024 | 15.54 | 28.32 | +12.58 | signal |
| 30 May 2024 | 20 Nov 2024 | 15.99 | 17.14 | +0.96 | max hold |
| 22 Nov 2024 | 16 May 2025 | 14.31 | 22.50 | +7.99 | signal |
| 19 Feb 2026 | 2 Mar 2026 | 16.91 | 32.02 | +14.92 | signal |