MiddleHighLowMAStrat

Description

The Middle High Low MA (MHL MA) strategy is based on the eponymous study proposed by Vitali Apirine. The strategy adds simulated orders upon crossovers of a regular and a modified moving average (MA and MHL_MA) calculated by the study.

The averages share the type and the length, however, the modified moving average is not applied to an OHLC value, but to the price mid-range. The mid-range is defined as the arithmetic mean of the highest high and the lowest low, both found on the same lookback period. According to the study, the relation between the lookback period and the moving average length is as follows: a lookback period of 3 to 15 bars is suggested for moving averages with length of up to 50; periods of 15 to 50 bars are to be combined with moving averages as slow as 50 to 200 bars in length. These numbers are referential and can be easily customized in strategy input parameters.

Based on the behavior of the two averages, the strategy adds simulated orders as follows. If MA crosses above MHL_MA, the strategy adds a simulated buy order. Conversely, if MA crosses below MHL_MA, a simulated sell order is added.

Input Parameters

length Defines the length for calculation of both moving averages.
high low length Defines the length of the period upon which the highest high and the lowest low prices are found.
average type The type of moving average to be used in calculations: simple, exponential, weighted, Wilder's, or Hull.

Further Reading

1. "The Middle-High-Low Moving Average" by Vitali Apirine. Technical Analysis of Stocks & Commodities, August 2016.