Buy when short-term momentum crosses above long-term momentum
Step 2: Selecting Indicators for RSI Crossover System
RSI is a oscillator which depicts momentum in prices. We try using two RSI of different periods to judge the short-term momentum and long-term momentum. So trade entries will be based on RSI indicator.
However, by construction, RSI gives a lot of whipsaws while it oscillates up and down. So trade exits are done using RSI levels to avoid too frequent re-entries.
Step 3: Defining Clear Strategy Rules for Divergence Trading System
Buy: When short-term RSI crosses above long-term RSI
Sell: When RSI goes below 40 level
Step 4: AFL Coding Guide
The AFL uses looping on all bars to generate buy sell signals. This is because the entries and exit conditions are different but occur too frequently. Using flags in the loop help to confirm:
The proper cycle of Buy, Sell, Short and Cover signals is maintained
There are no consecutive buy or sell signals
Step 5: The Backtest
The strategy shows high instability when tested over different RSI periods. On some RSI periods there is profit while for others there is loss. It generates a significant profit of 4990 points, or Rs. 3,74,250/ over two years on one lot (75 shares). The winner% is just 35.29%, which also indicates instability in the 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 AFL for RSI Crossover System
Click here to download the RSI crossover strategy AFL
Click here to download the RSI crossover Indicator AFL