Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Detecting Divergence - MetaTrader 4 Script | Trading Script Download - MT4/MT5 Resources - MetaTrader 5 Resources

author EAcpu | 3 reads | 0 comments |

Detection of the divergences - indicator for MetaTrader 4

Detection of the divergences - indicator for MetaTrader 4

Detection of the divergences - indicator for MetaTrader 4

Detection of the divergences - indicator for MetaTrader 4

Detection of the divergences - indicator for MetaTrader 4

Detection of the divergences - indicator for MetaTrader 4

One of the six standard indicators (RSI, MACD, Momentum, RVI, Stochastic, Standard Deviation) included in DivergenceViewer is used as a data source for finding price divergences (in indicator terminology - base indicators ). The indicator can also be run with two non-standard indicators: Derivative and William Blau.

The parameters of the basic indicator are set in the input parameter block of the same name:

Detection of the divergences - indicator for MetaTrader 4

The parameters should be set in the same order as in the standard indicator. For example, for the stochastic basis indicator, it corresponds to the following:

If the number of basic indicator parameters is less than three, the corresponding calculation period is not displayed at all and the values ​​of these parameters are ignored. Therefore, for the RSI and Momentum indicators, it is enough to set the values ​​of only two parameters: "First calculation period" and "Indicator calculation price".

If you need to use another indicator as a basic indicator, select the value "Custom" in the "Basic indicator" parameter and fill in the following line in the "Custom indicator" block:

After setting up the basic indicator, you need to determine the maximum length of the divergence by filling in the "Depth to search for the second support point" parameter and define how far the price extremes must match the indicator extremes - the "From price extremes to indicator extremes" parameter.

Divergence registration is based on local extremum finding. To form any extremum, at least three bars are required, with the center being the extremum. Therefore, the registration of the divergence is delayed by two bars. The chart shows Type A divergence and bars marked with vertical lines (not part of the indicator) which show where the divergence registered.

Detection of the divergences - indicator for MetaTrader 4

A complete description of the indicator's functionality and the logic of its formation can be found in the " Divergence on the Current Chart " article.


Attachment download

📎divergenceviewer_ad.mq4 (63.8 KB)

Source: MQL5 #13784

Verification code Refresh