RSI AFL Trading System

To design the RSI AFL Trading System, we carefully study the trading rules provided by RSI’s founder Welles Wilder, and apply the coding in Amibroker.


Step 1: The Trading Idea

We try to buy when a) momentum is strong b) exit when momentum is weak.

Step 2: Selecting Indicators for RSI AFL Trading System

The RSI is perhaps the most popular momentum indicator among traders. By calculation, it compares increase in prices versus decrease in prices. It reaches the overbought level (70) when there is upwards momentum and trend is strong. When there is downward momentum, it goes to oversold level (30). Before going to the oversol level, the level 40 indicates that bulls have mostly extinguished in the market. We will use the default period 14 suggested by Welles Wilder.

Since we are using purely momentum to time our trades, any filter for sideways market is not required.

Step 3: Defining Clear Strategy Rules

Buy: When RSI crosses above 70 level

Sell:  When RSI crosses below 40 level


Step 4: AFL Coding Guide

This is perhaps the simplest afl trading system in which the afl code can be understood by non-programmers also. We carefully definer the Buy, Sell, Short and Cover rules; where Short and Cover are symmetrically opposite if Buy and Sell.

Step 5: The Backtest

The strategy is significantly profitable in Bank Nifty current month futures. It generates a profit of 5669 points, or Rs. 4,25,175/ over two years on one lot. The winner% is 40.61, which is fair for a purely momentum based strategy.

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 intoduce custom stoploss as well as profit targets to further maximize the profitability.

Download RSI AFL trading System

Click here to download the editable Amibroker AFL Strategy