BearishDivergence (Function)
The BearishDivergence function identifies higher occurrences of Pivot highs in one value, accompanied by lower Pivot highs in another value. A Pivot High is a significant high value preceded and proceeded by some number of lower values.
BearishDivergence is normally identified when a price (High) makes a Pivot high that is higher than the previous Pivot high, and an oscillator (Stochastic, RSI, BollingerBands) makes a Pivot high that is lower than the previous Pivot high.
Syntax
BearishDivergence(Price1,Price2,Strength,Length)
Returns (Integer)
The function returns a value of 1 if the BearishDivergence condition is True for the current bar, otherwise it returns 0.
Parameters
Name | Type | Description |
Price1 | Numeric | Specifies which bar value (price, function, or formula) to use for the first pivot point. |
Price2 | Numeric | Specifies which bar value (price, function, or formula) to use for the second pivot point. |
Strength | Numeric | Sets the number of bars on either side of the pivot high point. |
Length | Numeric | Sets the maximum number of bars between pivot high points. |
Remarks
The input parameters Price1 and Price2 can be a bar value such as Close, High, Low, Open, or Volume. They can also be any mathematical calculation such as High + Low) / 2, or a numeric function such as RSI, Stochastic, or ADX.
Increasing the Strength input parameter will normally decrease the number of True occurrences.
Increasing the Length input parameter will normally increase the chances for True of occurrences.
The value for Length and Strength should always be a positive whole number greater than 0.
Example
Plots a ShowMe on the High when a BearishDivergence occurs between a Pivot High and the Pivot high of the RSI oscillator on any bar, where the Pivot Strength is 2 and the Pivot Length is 20:
if BearishDivergence(High, RSI(Close,14), 2, 20) = 1 then
Plot1(High, "BearDrvg");
Reference
Wilder, Welles, Jr. New Concepts in Technical Trading Systems. Trend Research. McLeansville, NC.