AFL For RSI Trigger Line Strategy - AlgoJi

Step 1: The Trading Idea

Buy when current momentum is above average momentum

Step 2: Selecting Indicators for RSI Trigger Line Strategy

Continuing from our RSI Crossover System, we try to test the profitability of RSI with its own average (trigger line). The moving average of RSI indicates the average momentum, while RSI indicates current momentum. So we are trying to buy when RSI crosses above its moving average.

The concept of Moving Average (MA) crossover is very familiar in Technical Analysis. Most of the indicators are based on Moving Average- MACD, CCI, Stochastics, ADX, Bollinger Bands etc.

The short RSI period of 7 is used to generate sufficient signals. The Moving Average period used is 15, arbitrarily the double of RSI period.

Step 3: Defining Clear Strategy Rules for RSI Trigger Line Strategy

Buy: When RSI crosses above its trigger line and RSI>60

Sell:  When RSI goes below trigger line and RSI<40

RSI Trigger Line Strategy

Step 4: AFL Coding Guide

The AFL code is pretty straightforward. Care is taken to define Buy, Sell, Short and Cover properly. The signal cycles are checked in default code to ensure proper signal occurrence.

Step 5: The Backtest

The strategy seems significantly profitable in Bank Nifty current month futures. It generates a profit of 7515 points, or Rs. 5,63,625/ over two years on one lot (75 shares). The winner% is 37.07, which is a bit low.

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 RSI Trigger Line Strategy

Click here to download the editable Amibroker AFL for RSI Trigger Line Strategy

Click here to download RSI Trigger Line Indicator AFL