Search This Blog

Friday

MACD with adaptive definition of price extremes



From the usual type MACD forex indicator _MACD_Xtr be different levels of adaptive zones of PC / PP (gray dotted line), as well as the color bars in the histogram corresponding colors upon entering MACD in these zones.

  Principles.
Usually, the adaptation of the indicator as a regulator uses very light. . A rose, for example, the scope MACD - correspondingly increased and the level of zones overbought / oversold levels.  The problem of this approach - in the phase delay.  Ie first indicator will show this overbought or oversold, and only then, with a delay of smoothing moves the band to a new level.  As a result, the extremum will be shown at the beginning of the movement - the meaning of such an adaptation is only for subsequent extrema. ? And if it is V-/ \-shaped formation, but no W-M?  And at the last to lose the benefits of the first extremum somehow do not want to. Каков выход? What is the exit?  For lack of a time machine seems reasonable to use a source of volatility with a smaller period than the adaptive indicator.  In this case, you can "preempt" the movement of the indicator, shifting levels of overbought / oversold before it begins its movement to them.  But here arises from the complexity of the implementation of the two conflicting conditions for the control signal: on the one hand it can not be smooth so as not to make a phase delay with an increase in volatility, and the other to retain and filter the noise made by the same level of volatility.  To solve this problem, a separate anti-aliasing filtering for the front and damping, the principle of which is described here. In this case, need only filter attenuation, and filtering of the front of the control signal is not needed at all. (Уж лучше сам период волатильности увеличить.))) (It is better for himself period of volatility to increase.)))
In the picture explains the principle of identifying areas overbought / oversold levels.. In the second pane withdrawn TR (True Range), averaged over the 5-bars, ie – ATR(5),  - ATR (5), and smoothed attenuation EMA (66).  It is seen that the levels of PC / PP, built on the indicator from the second panes, ahead of the dramatic movement of MACD.

  Input parameters.
FastMA - a period of rapid EMA;
SlowMA - period of slow EMA;
Source - a source of volatility: 0 - volume, 1 - ATR; 2 - standard deviation;
BackPeriod - smoothing period damping;
xVolatility - the scale of volatility;
Sens - sensitivity is in pips.

The last parameter (Sens) can be left equal to zero, because  smoothed attenuation volatility, as a rule, does not reach a threshold of noise in liquid instruments.
With regards to the source of volatility (Source), then the best option in this particular application, in my opinion - is ATR. . Actually, this follows from the nature of MACD and ATR and is confirmed in practice.  The volume can be used, but because it is not normalized in the scale of prices, it will torment with scale factor (xVolatility).  Which is better - do not.
Smoothing damping (BackPeriod) default is 444.  For minutes and, with their intraday volatility of ailments - normally.  For the Bigger Time-Frames value can be reduced.  But it may be noted that the indicator is stable enough to improvise with the value of this parameter (in a reasonable, clear, stump, within - at least according to the logic of adaptation is seen as a slow period, twice the value of MA in the MACD).

Call indicator of user codes:
iCustom(NULL,0,"_MACD_Xtr",FastMA,SlowMA,Source,SourcePeriod,
FrontPeriod,xVolatility,Sens, N,i); 
 iCustom (NULL, 0, "_MACD_Xtr",
 FastMA, SlowMA, Source, SourcePeriod, 
FrontPeriod, xVolatility, Sens, N, i); 
where N - output buffers:
0 - MACD;
 1 - level overbought;
2 - level oversold;
3 - bar in the overbought zone;
4 - bar in the oversold zone;
For use in commercial systems of interest to the last two.

To use the indicator light is needed supplier smoothed volatility _Volatility_FBA_NR.  He would already be represented in the picture. His field settings are as follows:
Source - a source of volatility: 0 - volume, 1 - ATR, 2 - standard deviation;
FrontPeriod - smoothing period of the front;
. BackPeriod - smoothing period damping.

Download forex MACD indicator with adaptive definition of price extremes
Download_Volatility_FBA_NR.mq4

No comments: