AFL RSI Divergence Trading System & Indicator
Buy when RSI shows a positive divergence with strong momentum
Step 2: Selecting Indicators for Divergence Trading System
A divergence is one of the most important concepts for finding trend reversals. Since the market goes up in price swings, a decrease in momentum is a sign of reversal of uptrend. A momentum indicator such as RSI shows negative divergence when prices start losing momentum.
To find a negative divergence, we compare consecutive highs of prices with consecutive highs in RSI. If prices make a higher high but RSI makes a lower high, a negative divergence is confirmed. Similarly the positive divergence is also calculated.
Algoji removes the tiring process of manually finding out divergence by providing an automatic divergence detection formula. The same classic divergence detection rules which are used manually, are also used by the AFL formula.
Step 3: Defining Clear Strategy Rules for Divergence Trading System
Buy: When RSI shows positive divergence and RSI value is more than 70
Sell: When prices show negative divergence OR RSI value is less than 30
Step 4: AFL Coding Guide
We modify the custom peak and trough functions in Amibroker to avoid a future looking formula. This is an advanced code which detects divergence but without looking at future prices.
Step 5: The Backtest
The strategy is significantly profitable in Bank Nifty current month futures. It generates a profit of 4762 points, or Rs. 3,57,150/ over two years on one lot (75 shares). The winner% is 45.9, which is good for a trend reversal system.
Related Article: Basics in Strategy Backtesting
- Scrip: Bank Nifty current month futures, 15-minute
- All trades executed at Close price of the bar on which signal is triggered
- Brokerage: 0.01% of Trade Value
- Data History: 01-01-2014 to 31-12-2015 (two years)
- Strategy Optimization: None
Step 6: Further Improvement
We leave it to the readers to suggest any improvement in Step 2 and Step 3 which can increase the profitability. We can introduce custom stoploss as well as profit targets to further maximize the profitability.
Download here Divergence Trading System
Click here to download the editable Amibroker Divergence Trading System AFL Strategy
Click here to download the RSI Divergence Indicator