Home    |    Trading Alchemy Manual    |    Alchemy Functions Index

AlchemyDivergeUniver (Function)

AlchemyDivergeUniver is a multiple-output function that provides the calculation of bearish and bullish divergence of the Alchemy UniverDiverg indicator.  This function can be used to detect divergence as follows:
Divergence between price and any specified oscillator
Divergence between 2 different price series
Divergence between 2 specified oscillators

Divergence can be specified as regular divergence, opposite divergence or reverse divergence.

AlchemyDivergeUniver(ReverseDivergence,MinimumBars,MaximumBars,MaximumPivotsBack,BearPrice,BullPrice,MinBearPriceDifference,MinBullPriceDifference,PivotLeftStrength,PivotRightStrength,

PivotMaxEqualBars,PivotUnEqualBars,BearOsc,BullOsc,MinimumBearOscHook,MinimumBullOscHook,BearOscLeadingBars,BearOscLaggingBars,BullOscLeadingBars,BullOscLaggingBars,

OppositeBearishOscillator,OppositeBullishOscillator,UseBearishThreshold1,UseBearishThreshold2,UseBullishThreshold1,UseBullishThreshold2,BearishThreshold1,BearishThreshold2,

BullishThreshold1,BullishThreshold2,MinBearOscDivergence,MinBullOscDivergence,TestForBearOscPeakTrough,TestForBullOscPeakTrough,oBearDiv,oBullDiv,oHigh1,oHigh2,oLow1,

oLow2,oHigh1Bar,oHigh2Bar,oLow1Bar,oLow2Bar,oBearOsc1,oBearOsc2,oBullOsc1,oBullOsc2,oBearOsc1Bar,oBearOsc2Bar,oBullOsc1Bar,oBullOsc2Bar)

Parameters

 

ReverseDivergence

Parameter type: trueFalse  A setting of false uses regular divergence as defined as follows:  Bearish Divergence: Higher prices and lower oscillator - Bullish Divergence: Lower prices and higher oscillator.  A setting of true uses reverse divergence as defined as follows:  Bearish Divergence: Lower prices and higher oscillator - Bullish Divergence: Higher prices and lower oscillator

MinimumBars

Parameter type: numericsimple  Specifies the minimum number of required bars in between 2 price pivots.

MaximumBars

Parameter type: numericsimple  Specifies the maximum number of allowed bars in between 2 price pivots, whereas a setting of 0 disables this requirement.
MaximumPivotsBack Parameter type: numericsimple  Specifies the maximum number of price pivots for the function to look back for divergence.
BearPrice Parameter type: numericseries  Specifies the price to be used for bearish divergence. This can be specified as high in order to look for bearish divergence between price highs and an oscillator as specified with the input BearOsc or it can be specified as an oscillator function to be pasted in from the EasyLanguage dictionary for bearish divergence between this oscillator and a second oscillator as specified with the input BearOsc.
BullPrice Parameter type: numericseries  Specifies the price to be used for bullish divergence. This can be specified as low in order to look for bearish divergence between price lows and an oscillator as specified with the input BullOsc or it can be specified as an oscillator function to be pasted in from the EasyLanguage dictionary for bullish divergence between this oscillator and a second oscillator as specified with the input BullOsc.
MinBearPriceDifference Parameter type: numericsimple  Specifies the minimum required point/dollar price difference between two bearish price pivots. This can also be a negative value in order to qualify for divergence even if the second price pivot is shy by this specified distance from the first price pivot. For example, with a setting of 1, the second price pivot has to be at least 1 point higher from the first price pivot in order to qualify for bearish divergence and with a setting of -1, the second price pivot can be as much as 1 point lower than the first price pivot in order to still qualify for bearish divergence.
MinBullPriceDifference Parameter type: numericsimple  Specifies the minimum required point/dollar price difference between two bullish price pivots. This can also be a negative value in order to qualify for divergence even if the second price pivot is shy by this specified distance from the first price pivot. For example, with a setting of 1, the second price pivot has to be at least 1 point lower from the first price pivot in order to qualify for bullish divergence and with a setting of -1, the second price pivot can be as much as 1 point higher than the first price pivot in order to still qualify for bullish divergence.
PivotLeftStrength Parameter type: numericsimple  Specifies the minimum required number of bars with lower lows to the left of a pivot high or the minimum required number of bars with higher highs to the left of a pivot low in order to qualify as a previous pivot to compare for divergence. The current price for detecting divergence does not need to be an actual pivot.
PivotRightStrength Parameter type: numericsimple  Specifies the minimum required number of bars with lower lows to the right of a pivot high or the minimum required number of bars with higher highs to the right of a pivot low in order to qualify as a previous pivot to compare for divergence. The current price for detecting divergence does not need to be an actual pivot.
PivotMaxEqualBars Parameter type: numericsimple  Specifies the maximum number of allowed bars with equal higher highs in order to still qualify as one previous pivot high to compare for divergence or the maximum number of allowed bars with equal lows in order to still qualify as one previous pivot low to compare for divergence The current price for detecting divergence does not need to be an actual pivot.
PivotUnEqualBars Parameter type: numericsimple  Specifies the maximum number of allowed bars with lower highs in between 2 equal highs in order to still qualify as one previous pivot high to compare for divergence or the maximum number of allowed bars with higher lows in between 2 equal lows in order to still qualify as one previous pivot low to compare for divergence The current price for detecting divergence does not need to be an actual pivot.
BearOsc Parameter type: numericseries  Specifies the oscillator to be used for bearish divergence. This can be specified an oscillator function to be pasted in from the EasyLanguage dictionary or a second data series price data such as high of data(2).
BullOsc Parameter type: numericseries  Specifies the oscillator to be used for bullish divergence. This can be specified an oscillator function to be pasted in from the EasyLanguage dictionary or a second data series price data such as low of data(2).
MinimumBearOscHook Parameter type: numericsimple  Specifies the minimum oscillator hook that is required to look for bearish divergence, whereas with a setting of 0 the oscillator needs to be hooking down by more than just 0. A bearish hook always creates a peak and the minimum hook distance is specified in the value difference between the peak value and the oscillator value as it slopes down. Once a down hook is formed, the function looks for divergence back to previous pivots. With a negative setting, the oscillator does not need to hook and the function constantly compares price as specified with the input BearPrice and the current oscillator value with previous pivots and their oscillator values.
MinimumBullOscHook Parameter type: numericsimple  Specifies the minimum oscillator hook that is required to look for bullish divergence, whereas with a setting of 0 the oscillator needs to be hooking up by more than just 0. A bullish hook always creates a trough and the minimum hook distance is specified in the value difference between the trough value and the oscillator value as it slopes up. Once an up hook is formed, the function looks for divergence back to previous pivots. With a negative setting, the oscillator does not need to hook and the function constantly compares price as specified with the input BullPrice and the current oscillator value with previous pivots and their oscillator values.
BearOscLeadingBars Parameter type: numericsimple  Specifies the maximum number of bars that the bearish oscillator is expected to form a pivot before price does in order to find the corresponding price/oscillator pivots for detecting bearish divergence.
BearOscLaggingBars Parameter type: numericsimple  Specifies the maximum number of bars that the bearish oscillator is expected to form a pivot after price does in order to find the corresponding price/oscillator pivots for detecting bearish divergence.
BullOscLeadingBars Parameter type: numericsimple  Specifies the maximum number of bars that the bullish oscillator is expected to form a pivot before price does in order to find the corresponding price/oscillator pivots for detecting bullish divergence.
BullOscLaggingBars Parameter type: numericsimple  Specifies the maximum number of bars that the bullish oscillator is expected to form a pivot after price does in order to find the corresponding price/oscillator pivots for detecting bullish divergence.
OppositeBearishOscillator Parameter type: trueFalse  A setting of true uses opposite bearish divergence as defined as follows:  Regular opposite bearish divergence: Higher prices and higher oscillator.  Reverse opposite bearish divergence: Lower prices and lower oscillator
OppositeBullishOscillator Parameter type: trueFalse  A setting of true uses opposite bullish divergence as defined as follows:  Regular opposite bullish divergence: Lower prices and lower oscillator.  Reverse opposite bullish divergence: Higher prices and higher oscillator
UseBearishThreshold1 Parameter type: trueFalse  Enables/disables the requirement of the first bearish oscillator pivot to be beyond a threshold as specified with the input BearishThreshold1.
UseBearishThreshold2 Parameter type: trueFalse  Enables/disables the requirement of the second bearish oscillator pivot to be beyond a threshold as specified with the input BearishThreshold2.
UseBullishThreshold1 Parameter type: trueFalse  Enables/disables the requirement of the first bullish oscillator pivot to be beyond a threshold as specified with the input BullishThreshold1.
UseBullishThreshold2 Parameter type: trueFalse  Enables/disables the requirement of the second bullish oscillator pivot to be beyond a threshold as specified with the input BullishThreshold2.
BearishThreshold1 Parameter type: numericsimple  Specifies the threshold for the first bearish oscillator pivot.
BearishThreshold2 Parameter type: numericsimple  Specifies the threshold for the second bearish oscillator pivot.
BullishThreshold1 Parameter type: numericsimple  Specifies the threshold for the first bullish oscillator pivot.
BullishThreshold2 Parameter type: numericsimple  Specifies the threshold for the second bullish oscillator pivot.
MinBearOscDivergence Parameter type: numericsimple  Specifies the minimum required bearish oscillator value difference between two bearish oscillator pivots. This can also be a negative value in order to qualify for divergence even if the second bearish oscillator price still exceeds the first bearish oscillator pivot by this specified distance. For example, if the bearish oscillator is a Stochastic and with a setting of 10, the second bearish oscillator pivot has to be lower by at least 10 from the first bearish oscillator pivot in order to qualify for bearish divergence and with a setting of -10, the second bearish oscillator pivot can still be higher than 10 points from the first bearish oscillator pivot in order to still qualify for bearish divergence.
MinBullOscDivergence Parameter type: numericsimple  Specifies the minimum required bullish oscillator value difference between two bullish oscillator pivots. This can also be a negative value in order to qualify for divergence even if the second bullish oscillator price is still lower than first bullish oscillator pivot by this specified distance. For example, if the bullish oscillator is a Stochastic and with a setting of 10, the second bullish oscillator pivot has to be higher by at least 10 from the first bullish oscillator pivot in order to qualify for bullish divergence and with a setting of -10, the second bullish oscillator pivot can still be lower than 10 points from the first bullish oscillator pivot in order to still qualify for bearish divergence.
TestForBearOscPeakTrough Parameter type: trueFalse  With a setting of true, the first bearish oscillator pivot has to be the highest pivot for regular bearish divergence and the first bearish oscillator pivot has to be the lowest pivot for regular opposite bearish divergence. This avoids detecting bearish divergence if there is a higher bearish oscillator pivot in between two oscillator pivots.
TestForBullOscPeakTrough Parameter type: trueFalse  With a setting of true, the first bullish oscillator pivot has to be the lowest pivot for regular bullish divergence and the first bullish oscillator pivot has to be the highest pivot for regular opposite bullish divergence. This avoids detecting bullish divergence if there is a lower bullish oscillator pivot in between the two oscillator pivots.
oBearDiv Parameter type: truefalseref   Variable that receives true when there is bearish divergence.
oBullDiv Parameter type: truefalseref   Variable that receives true when there is bullish divergence.
oHigh1 Parameter type: numericref   Variable that receives the high value of the first price peak.
oHigh2 Parameter type: numericref   Variable that receives the high value of the second price peak.
oLow1 Parameter type: numericref   Variable that receives the low value of the first price trough.
oLow2 Parameter type: numericref   Variable that receives  the low value of the second price trough.
oHigh1Bar Parameter type: numericref   Variable that receives the bar number of the first price peak.
oHigh2Bar Parameter type: numericref   Variable that receives the bar number of the second price peak.
oLow1Bar Parameter type: numericref   Variable that receives the bar number of the first price trough.
oLow2Bar Parameter type: numericref   Variable that receives the bar number of the second price trough.
oBearOsc1 Parameter type: numericref   Variable that receives the oscillator value of the first bearish oscillator peak.
oBearOsc2 Parameter type: numericref   Variable that receives the oscillator value of the second bearish oscillator peak.
oBullOsc1 Parameter type: numericref   Variable that receives the oscillator value of the first bullish oscillator trough.
oBullOsc2 Parameter type: numericref   Variable that receives the oscillator value of the second bullish oscillator trough.
oBearOsc1Bar Parameter type: numericref   Variable that receives the bar number of the first bearish oscillator peak.
oBearOsc2Bar Parameter type: numericref   Variable that receives the bar number of the second bearish oscillator peak.
oBullOsc1Bar Parameter type: numericref   Variable that receives the bar number of the first bullish oscillator trough.
oBullOsc2Bar Parameter type: numericref   Variable that receives the bar number of the second bullish oscillator trough.

 

Home    |    Trading Alchemy Manual    |    Alchemy Functions Index