AFL System for Dynamic Momentum Index - AlgoJi

Step 1: The Trading Idea

We try to identify momentum without using any fixed number of periods. The market is dynamic and in this sense the periods used to calculate momentum should also change dynamically.

Step 2: Selecting Indicators for Dynamic Momentum Index System

The Dynamic Momentum Index (DMI) was developed by Tushar Chande and Stanley Kroll. The period of DMI changes dynamically depending upon recent volatility. During slow market movement, the number of periods used to calculate DMI is increased.  The volatility indicator used in controlling the time periods in the DMI is based on a calculation using a five period standard deviation and a ten period average of the standard deviation.

A moving average on DMI is used to trigger signals. The periods used are: DMI (smoothening) = 20 and DMI (average)= 30.

However, the DMI, being a momentum oscillator, produces too many signal triggers. To filter the signals, we further use PDI and MDI levels.

Step 3: Defining Clear Strategy Rules

Buy:  When DMI crosses above its average and Plus Directional Index is greater than 25

Sell:  When DMI crosses below its average

Dynamic Momentum Index

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 define the Buy, Sell, Short and Cover rules; where Short and Cover are symmetrically opposite if Buy and Sell. This helps in smooth integration of this AFL with automated trading systems

Step 5: The Backtest

Even in the simplest form, the strategy is profitable in Bank Nifty current month futures. It generates a profit of 4320 points, or Rs. 3,24,000 over two years on one lot (75 shares). The winner% is 47.57, which is also decent.

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 Dynamic Momentum Index AFL trading System

Click here to download the Dynamic Momentum Index AFL Strategy

Click here to download the Dynamic Momentum Index AFL Indicator

Click here to learn about Dynamic Momentum Index from Investopedia