Swing AFL Bollinger Bands Strategy


Step 1: The Trading Idea

Buy when prices “suddenly” move upward; sell when prices suddenly move downward. Similar to: ATR Bands Strategy

Step 2: Selecting Indicators for Trading System

Often a change in trend is indicated by a quick or sudden move in the direction of change. This sudden move also indicates momentum in the new direction.

We try to exploit this trading idea using Bollinger Bands. The Bollinger Bands are plotted by adding/subtracting the standard deviations (SD) to moving average. The moving average (MA) indicates the average price movement. When prices move above the EMA+SD value, it indicates a sudden upmove, or an upwards thrust.

The Bollinger Bands show strength similar to momentum oscillators like RSI or Stochastics. When prices close above upper band, it indicates upward trend. The default periods used in Bollinger Band is 20. However, we use 50 periods band because we are testing strategy on intraday timeframe and short periods gives more false signals. By using 50 period bands with 2 standard deviations, almost 90% of price action is contained within Bollinger Bands.

Step 3: Defining Clear Rules for AFL Bollinger Bands

Buy: When price cross above the upper Bollinger Band

Sell:  When prices cross below the lower Bollinger Band

AFL Bollinger Bands

Please note that this is a signal-to-signal, or a stop-and-reverse 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 is remarkably profitable in Bank Nifty current month futures. It generates a profit of 8041 points, or Rs. 6,03,075/- over two years on one lot (75 shares). The winner% is 43.33, which is a also good for a trend following stop-and-reverse 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 introduce custom stoploss as well as profit targets to further maximize the profitability.

Download here Swing AFL Bollinger Bands Strategy

Click here to download the editable Amibroker AFL Bollinger Bands Strategy

Click here to learn more about Bollinger Bands from Charts School