A Mean-Reversion Strategy for US Crude Oil WTI
The Idea
This strategy is mainly built on a single indicator, the RSI Divergence from ProRealCode. This indicator detects bullish and bearish divergences between price and the RSI. A bullish divergence occurs when the stock price makes new lows while the indicator starts to climb upward. A bearish divergence occurs when the stock price makes new highs while the indicator starts to go lower. We also implement a moving average crossover as a filter. So with something as simple as one indicator and one filter we can get something quite interesting. Out-of-sample for this strategy is since 2021-01-01.

Setup for Backtest
Market: US Crude Oil (WTI)
Contract: 1 € per point
Broker: IG
Testing environment: ProRealtime 12
Timeframe: Daily
Time zone: CET
No fees and commissions are included.
Result
Total gain: 28 699.3 €
Average gain: 123.17 €
Total trades: 233
Winners: 172
Losers: 61
Breakeven: 0
Max drawdown: –2 887.7 €
Risk/reward ratio: 1.15
Total time in the market: 35.52 %
Average time in the market: 11 days, 15 hours
CAGR (10 000 € in starting capital): 4.61 %

Entry Conditions
Long Entry
MA[20] is higher today than yesterday.
A bullish signal from the RSI Divergence Indicator [3,40,70,20].
Short Entry
MA[20] is lower than yesterday.
MA[10] is also lower than yesterday.
A bearish signal from the RSI Divergence Indicator [3,20,70,20].
Exit Conditions
Long Exit
A bearish signal from the RSI Divergence Indicator [3,40,70,20]
Or if the number of bars since entry exceeds 40.
Short Exit
A bullish signal from the RSI Divergence Indicator [3,20,70,20]
Or if the number of bars since entry exceeds 40.
Code
ProRealTime
Read more about the RSI Divergence Indicator here: https://www.prorealcode.com/documentation/divergencersi/
FAQ
Q: Am I free to use this strategy however I want?
A: Sure! But we're happy if you refer to our website and keep the creator's name in the code.
Q: I'm using another platform, can you write the code in another language?
A: No, sorry. We might add code in more languages later to the website, but until then, we recommend you try ChatGPT or something similar to help you rewrite it.
Q: Why does my backtest look different when I run the code?
A: The strategy might give different backtest results for several reasons, like added spread or fees, the wrong time-zone settings, or that you're using another type of contract or instrument.
Q: Will I make money if I run this strategy live?
A: We don't know. We're not financial advisors, we're just traders sharing our ideas.
If you want to start trading with ProRealTime, you can try it here for free: