• Overview
  • Reviews
  • Comments (11)

Predictor of the MA


I think, almost all traders dream about non-lagging MA. I have realized that dream in my indicator. It allows forecasting future MA values! The indicator can be used in four different ways:

  • The first one - forecast for the desired amount of bars. Thus, you are able to evaluate future price behavior.
  • The second one - generating non-lagging "averages". That can be implemented by moving MA back by the half of the averaging period and setting the forecast the necessary amount of bars ahead.
  • The third one is well-liked crossing of two or more MAs, though not a present but a future one. Using a future МА crossing, you will be able to eliminate the main drawback of this method - lagging entry and exit signal.
  • Finally, this indicator will be of use for Bill Williams' followers. You can create "Alligator" consisting of predicted averages to sort out multiple false entries and increase your system's profitability.

The indicator contains all settings of standard terminal МАs. You can set a backward/forward shift, select averaging method and the price the averaging is applied to.

The forecast can be made using five different methods that can be specified in the settings. The first method - spectral analysis using Fourier transform. The remaining four ones are the methods of linear prediction in different variations.

The indicator shows good results if past bars = 1 000, harm No = 400 and the first method is used. If you are going to use linear prediction methods, I recommend past bars = from 2 000 to 5 000.


  • Method - prediction method (1 - using Fourier transform, 2, 3, 4, 5 - linear prediction methods).
  • LastBar - bar number, at which you start the forecast (0 - current bar, any other bar means the number of bars in the past).
  • PastBars - the number of bars used for analysis (the recommended value for Fourier transform is from 100 to 1 000, a greater number will slow down; you may use more than 10 000 for other methods, but you will have to wait).
  • LPOrder - prediction accuracy from 0 to 1 (used only for linear prediction methods).
  • FutBars - the number of bars to predict (should not exceed PastBars, better 2-3 times less than it).
  • HarmNo - the maximum number of frequencies for Fourier transform (recommended 1/2 or 1/3 of PastBars, strongly affects calculation speed; the higher the number is, the slower it calculates. Should not exceed PastBars; if the value is large, a notification will appear on your screen).
  • FreqTOL - prediction accuracy for Fourier transform (the higher the accuracy is, the slower it calculates. Recommended no more than 0.00000001).
  • FreqMax - maximum number of iterations for frequencies convergence (can be left unchanged).
  • BurgWin - a function for weighted averaging (for linear prediction methods; 0 = no weighted averaging, 1 = Hamming method, 2 = Parabolic method).
  • ma_period - MA period placed similar to the standard indicator.
  • ma_shift - shifting the average forward/backwards, like in the standard indicator. Set a negative number of bars to shift backwards.
  • ma_method - averaging method. 1 - simple, 2 - exponential, 3 - weighted, 4 - linear regression.
  • applied_price - price type - what price is to be used for averaging. 1-  CLOSE, 2 - OPEN, 3 - HIGH, 4 - LOW, 5 - HL/2, 6 - HLC/3, 7 - HLCC/4.

Operation Principles

To make non-lagging МА, set Last bars = ma_shift =1/2 ma_period. ma_shift value should be negative.

Calculations may take from a fraction of a second to several minutes or tens of minutes and even days, depending on the depth of history involved in the analysis. If the terminal does not respond, then the indicator is being calculated. Just wait a little. The indicator never causes terminal hang, it eventually will finish calculation. Do not use more than 3 000 bars for Fourier transform (for other methods do not use more than 20 000), since this greatly slows down the process.

The indicator is recalculated on each new bar. Thus, make sure that the calculation duration does not exceed the specified timeframe. If you set a large number of past bars, it is recommended to check the time of calculation on H4 first. Otherwise, the calculation may never be finished (you can safely set M5 timeframe in case recommended parameters and ordinary computer are used).

No reviews