Home    |    Trading Alchemy Manual    |    Alchemy Functions Index

AlchemyDivergeUniv02 (Function)

AlchemyDivergeUniv02 is a multiple-output function that returns the divergence values of our Alchemy Ultimate Divergence indicators within its multiple output variables.

 The function returns 1 when the multiple output variable oBullDiv is true, the function returns -1 when the multiple output variable oBearDiv is true and otherwise, the function returns 0.

 

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.

AlchemyDivergeUniv02

(

BearPrice_PriceType,BearPrice_SpecPrice,BearPrice_DataSeriesNum,BearPrice_OscPrice,

BearPrice_OscLength1,BearPrice_OscLength2,BearPrice_OscLength3,BearPrice_AvgLength,BearPrice_AvgType,

BullPrice_PriceType,BullPrice_SpecPrice,BullPrice_DataSeriesNum,BullPrice_OscPrice,

BullPrice_OscLength1,BullPrice_OscLength2,BullPrice_OscLength3,BullPrice_AvgLength,BullPrice_AvgType,

BearOsc_PriceType,BearOsc_SpecPrice,BearOsc_DataSeriesNum,BearOsc_OscPrice,

BearOsc_OscLength1,BearOsc_OscLength2,BearOsc_OscLength3,BearOsc_AvgLength,BearOsc_AvgType,

BullOsc_PriceType,BullOsc_SpecPrice,BullOsc_DataSeriesNum,BullOsc_OscPrice,

BullOsc_OscLength1,BullOsc_OscLength2,BullOsc_OscLength3,BullOsc_AvgLength,BullOsc_AvgType,

ReverseDivergence,

MinimumBars,MaximumBars,MaximumPivotsBack,

MinBearPriceDifference,MinBullPriceDifference,

PivotLeftStrength,PivotRightStrength,PivotMaxEqualBars,PivotUnEqualBars,

MinimumBearOscHook,MinimumBullOscHook,

BearOscLeadingBars,BearOscLaggingBars,BullOscLeadingBars,BullOscLaggingBars,

OppositeBearishOscillator,OppositeBullishOscillator,

UseBearPriceThresh1,UseBearPriceThresh2,UseBullPriceThresh1,UseBullPriceThresh2,

BearishPriceThreshold1,BearishPriceThreshold2,BullishPriceThreshold1,BullishPriceThreshold2,

UseBearishThreshold1,UseBearishThreshold2,UseBullishThreshold1,UseBullishThreshold2,

BearishThreshold1,BearishThreshold2,BullishThreshold1,BullishThreshold2,

MinBearOscDivergence,MinBullOscDivergence,

TestForBearOscPeakTrough,TestForBullOscPeakTrough,

oBearPrice,oBullPrice,oBearOsc,oBullOsc,

oBearDiv,oBullDiv,

oHigh1,oHigh2,oLow1,oLow2,

oHigh1Bar,oHigh2Bar,oLow1Bar,oLow2Bar,

oBearOsc1,oBearOsc2,oBullOsc1,oBullOsc2,

oBearOsc1Bar,oBearOsc2Bar,oBullOsc1Bar,oBullOsc2Bar

)

Parameters

BearPrice_PriceType Specifies the predefined price to be used for bearish divergence.  A setting of 0 uses price as specified with the input BearPrice_SpecPrice, a setting of -1 uses the open, a setting of -2 uses the high, a setting of -3 uses the low,  a setting of -4 uses the close, a setting of -5 uses the volume, a setting of -6 uses the sum of down and up ticks, a setting of -7 uses upticks, a setting of -8 uses downticks, a setting of 1 uses the Stochastic FastK, a setting of 2 uses the Stochastic FastD, a setting of 3 uses the Stochastic SlowK, a setting of 4 uses the Stochastic SlowD, a setting of 5 uses the RSI, a setting of 6 uses the MACD and a setting of 7 uses the CCI.
BearPrice_SpecPrice 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 the specified oscillator or it can be specified as an oscillator function to be pasted in from the EasyLanguage dictionary for bearish divergence between this oscillator and the second oscillator.  In order to utilize this input the predefined bearish price type in the input BearPrice_PriceType needs to be set to 0.
BearPrice_DataSeriesNum Specifies the data series number to be used for the predefined price types -1 through -8 as specified with the input BearPrice_PriceType.
BearPrice_OscPrice Specifies the price to be used for the predefined oscillator types 5 through 7 as specified with the input BearPrice_PriceType.
BearPrice_OscLength1 Specifies the first length for the predefined oscillator types 1 through 7 as specified with the input BearPrice_PriceType.
BearPrice_OscLength2 Specifies the second length for the predefined oscillator types 1 through 7 as specified with the input BearPrice_PriceType.
BearPrice_OscLength3 Specifies the third length for the predefined oscillator types 1 through 7 as specified with the input BearPrice_PriceType.
BearPrice_AvgLength Specifies the average length for the predefined oscillator types 1 through 7 as specified with the input BearPrice_PriceType.
BearPrice_AvgType Specifies the average type for the predefined oscillator types 1 through 7 as specified with the input BearPrice_PriceType.  A setting of 1 uses a simple moving average, a setting of 2 uses an exponential moving average, a setting of 3 uses a weighted moving average, a setting o 4 uses a triangular moving average, a setting of 5 uses a Mid Keltner and a setting of 6 uses a Hull moving average.
BullPrice_PriceType Specifies the predefined price to be used for bullish divergence.  A setting of 0 uses price as specified with the input BullPrice_SpecPrice, a setting of -1 uses the open, a setting of -2 uses the high, a setting of -3 uses the low,  a setting of -4 uses the close, a setting of -5 uses the volume, a setting of -6 uses the sum of down and up ticks, a setting of -7 uses upticks, a setting of -8 uses downticks, a setting of 1 uses the Stochastic FastK, a setting of 2 uses the Stochastic FastD, a setting of 3 uses the Stochastic SlowK, a setting of 4 uses the Stochastic SlowD, a setting of 5 uses the RSI, a setting of 6 uses the MACD and a setting of 7 uses the CCI.
BullPrice_SpecPrice Specifies the price to be used for bullish divergence.  This can be specified as low in order to look for bullish divergence between price lows and the specified oscillator or it can be specified as an oscillator function to be pasted in from the EasyLanguage dictionary for bullish divergence between this oscillator and the second oscillator.  In order to utilize this input the predefined bullish price type in the input BullPrice_PriceType needs to be set to 0.
BullPrice_DataSeriesNum Specifies the data series number to be used for the predefined price types -1 through -8 as specified with the input BullPrice_SpecPrice.
BullPrice_OscPrice Specifies the price to be used for the predefined oscillator types 5 through 7 as specified with the input BullPrice_SpecPrice.
BullPrice_OscLength1 Specifies the first length for the predefined oscillator types 1 through 7 as specified with the input BullPrice_SpecPrice.
BullPrice_OscLength2 Specifies the second length for the predefined oscillator types 1 through 7 as specified with the input BullPrice_SpecPrice.
BullPrice_OscLength3 Specifies the third length for the predefined oscillator types 1 through 7 as specified with the input BullPrice_SpecPrice.
BullPrice_AvgLength Specifies the average length for the predefined oscillator types 1 through 7 as specified with the input BullPrice_SpecPrice.
BullPrice_AvgType Specifies the average type for the predefined oscillator types 1 through 7 as specified with the input BullPrice_SpecPrice.  A setting of 1 uses a simple moving average, a setting of 2 uses an exponential moving average, a setting of 3 uses a weighted moving average, a setting o 4 uses a triangular moving average, a setting of 5 uses a Mid Keltner and a setting of 6 uses a Hull moving average.
BearOsc_PriceType Specifies the predefined oscillator to be used for bearish divergence.  A setting of 0 uses the oscillator as specified with the input BearOsc_SpecPrice, a setting of -1 uses the open, a setting of -2 uses the high, a setting of -3 uses the low,  a setting of -4 uses the close, a setting of -5 uses the volume, a setting of -6 uses the sum of down and up ticks, a setting of -7 uses upticks, a setting of -8 uses downticks, a setting of 1 uses the Stochastic FastK, a setting of 2 uses the Stochastic FastD, a setting of 3 uses the Stochastic SlowK, a setting of 4 uses the Stochastic SlowD, a setting of 5 uses the RSI, a setting of 6 uses the MACD and a setting of 7 uses the CCI.
BearOsc_SpecPrice Specifies the oscillator to be used for bearish divergence.  This can be specified as an oscillator function to be pasted in from the EasyLanguage dictionary or as a second data series price data such as high of data(2).  In order to utilize this input the predefined bearish oscillator type in the input BearOsc_PriceType needs to be set to 0.
BearOsc_DataSeriesNum Specifies the data series number to be used for the predefined price types -1 through -8 as specified with the input BearOsc_PriceType.
BearOsc_OscPrice Specifies the price to be used for the predefined oscillator types 5 through 7 as specified with the input BearOsc_PriceType.
BearOsc_OscLength1 Specifies the first length for the predefined oscillator types 1 through 7 as specified with the input BearOsc_PriceType.
BearOsc_OscLength2 Specifies the second length for the predefined oscillator types 1 through 7 as specified with the input BearOsc_PriceType.
BearOsc_OscLength3 Specifies the third length for the predefined oscillator types 1 through 7 as specified with the input BearOsc_PriceType.
BearOsc_AvgLength Specifies the average length for the predefined oscillator types 1 through 7 as specified with the input BearOsc_PriceType.
BearOsc_AvgType Specifies the average type for the predefined oscillator types 1 through 7 as specified with the input BearOsc_PriceType.  A setting of 1 uses a simple moving average, a setting of 2 uses an exponential moving average, a setting of 3 uses a weighted moving average, a setting o 4 uses a triangular moving average, a setting of 5 uses a Mid Keltner and a setting of 6 uses a Hull moving average.
BullOsc_PriceType Specifies the predefined oscillator to be used for bullish divergence.  A setting of 0 uses the oscillator as specified with the input BullOsc_SpecPrice, a setting of -1 uses the open, a setting of -2 uses the high, a setting of -3 uses the low,  a setting of -4 uses the close, a setting of -5 uses the volume, a setting of -6 uses the sum of down and up ticks, a setting of -7 uses upticks, a setting of -8 uses downticks, a setting of 1 uses the Stochastic FastK, a setting of 2 uses the Stochastic FastD, a setting of 3 uses the Stochastic SlowK, a setting of 4 uses the Stochastic SlowD, a setting of 5 uses the RSI, a setting of 6 uses the MACD and a setting of 7 uses the CCI.
BullOsc_SpecPrice Specifies the oscillator to be used for bullish divergence.  This can be specified as an oscillator function to be pasted in from the EasyLanguage dictionary or as a second data series price data such as low of data(2).  In order to utilize this input the predefined bullish oscillator type in the input BullOsc_PriceType needs to be set to 0.
BullOsc_DataSeriesNum Specifies the data series number to be used for the predefined price types -1 through -8 as specified with the input BullOsc_SpecPrice.
BullOsc_OscPrice Specifies the price to be used for the predefined oscillator types 5 through 7 as specified with the input BullOsc_SpecPrice.
BullOsc_OscLength1 Specifies the first length for the predefined oscillator types 1 through 7 as specified with the input BullOsc_SpecPrice.
BullOsc_OscLength2 Specifies the second length for the predefined oscillator types 1 through 7 as specified with the input BullOsc_SpecPrice.
BullOsc_OscLength3 Specifies the third length for the predefined oscillator types 1 through 7 as specified with the input BullOsc_SpecPrice.
BullOsc_AvgLength Specifies the average length for the predefined oscillator types 1 through 7 as specified with the input BullOsc_SpecPrice.
BullOsc_AvgType Specifies the average type for the predefined oscillator types 1 through 7 as specified with the input BullOsc_SpecPrice.  A setting of 1 uses a simple moving average, a setting of 2 uses an exponential moving average, a setting of 3 uses a weighted moving average, a setting o 4 uses a triangular moving average, a setting of 5 uses a Mid Keltner and a setting of 6 uses a Hull moving average.

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.
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.
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
UseBearPriceThresh1 Enables/disables the requirement of the first bearish price pivot to be beyond a threshold as specified with the input BearishPriceThreshold1.
UseBearPriceThresh2 Enables/disables the requirement of the second bearish price pivot to be beyond a threshold as specified with the input BearishPriceThreshold2.
UseBullPriceThresh1 Enables/disables the requirement of the first bullish price pivot to be beyond a threshold as specified with the input BullishPriceThreshold1.
UseBullPriceThresh2 Enables/disables the requirement of the second bullish price pivot to be beyond a threshold as specified with the input BullishPriceThreshold2.
BearishPriceThreshold1 Specifies the threshold for the first bearish price pivot.
BearishPriceThreshold2 Specifies the threshold for the second bearish price pivot.
BullishPriceThreshold1 Specifies the threshold for the first bullish price pivot.
BullishPriceThreshold2 Specifies the threshold for the second bullish price pivot.
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.
oBearPrice Parameter type: numericref   Variable that receives the current price as specified for the bearish price.
oBullPrice Parameter type: numericref   Variable that receives the current price as specified for the bullish price.
oBearOsc Parameter type: numericref   Variable that receives the current value as specified for the bearish oscillator.
oBullOsc Parameter type: numericref   Variable that receives the current value as specified for the bullish oscillator.
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