Home | Trading Alchemy Manual | Alchemy Functions IndexAlchemyPivDiverge (Function)AlchemyPivDivergence is a multiple-output function that provides the calculation of Bearish and Bullish Divergence between price and a specified indicator. AlchemyPivDivergence (Bull, Bear, Occur, BearPrice, BullPrice, Osc, OVBOVS, OverB, OverS, Cycles, OverSCyc, OverBCyc, MinPos, MinNeg, Strength, MaxLength, MaxSwg, DivFact, oBearDiv, oBullDiv) Parameters |
Bull |
Enables/disables the search for bullish divergence. |
Bear |
Enables/disables the search for bearish divergence. |
Occur |
Specifies which occurrence (that is, 1 = most recent, 2 = 2nd most recent, and so on. |
BearPrice | Specifies which price of the asset of interest is to be used for bearish divergence. |
BullPrice | Specifies which price of the asset of interest is to be used for bullish divergence. |
Osc |
Specifies the indicator applied to the asset of interest. |
OVBOVS |
The function looks for bearish divergence when the indicator is in overbought territory as determined by the OverB input and it looks for bullish divergence when the indicator is in oversold territory as determined by the OverS input. This input enables or disables these overbought/oversold zones restrictions. |
OverB |
The function looks for bearish divergence when the indicator is in overbought territory as determined by this input. |
OverS |
The function looks for bullish divergence when the indicator is in oversold territory as determined by this input. |
Cycles |
When the function finds bearish divergence in overbought territory, it requires for the indicator to cycle back down into oversold territory as determined by the OverSCyc input, in order to qualify for the next bearish divergence in overbought territory. When the function finds bullish divergence in oversold territory, it requires for the indicator to cycle back up into overbought territory as determined by the OverBCyc input, in order to qualify for the next bullish divergence in oversold territory. This input enables or disables these overbought/oversold cycle restrictions. |
OverSCyc |
When the function finds bearish divergence in overbought territory, it requires for the indicator to cycle back down to oversold territory as determined by this input, in order to qualify for the next bearish divergence in overbought territory. |
OverBCyc |
When the function finds bullish divergence in oversold territory, it requires for the indicator to cycle back up into overbought territory as determined by this input, in order to qualify for the next bullish divergence in oversold territory. |
MinPos |
Specifies the minimum positive value in which to look for bearish divergence. A negative setting disables the positive value requirement. |
MinNeg | Specifies the minimum negative value in which to look for bullish divergence. A negative setting disables the negative value requirement. |
Strength | Specifies the required number of bars on either side to determine a swing point. |
MaxLength | Specifies the number of trailing bars to consider. |
MaxSwg | Specifies the maximum number of swings back to search for divergence. |
DivFact | Specifies the minimum amount by which the divergent oscillator needs to fail the oscillator pivot it is compared to. |
oBearDiv | A numeric reference that receives a 1 if bearish divergence is found at the current bar and it receives a 0 if bearish divergence is not found at the current bar. |
oBullDiv | A numeric reference that receives a 1 if bullish divergence is found at the current bar and it receives a 0 if bullish divergence is not found at the current bar. |
ReturnsAlchemyPivDivergence always returns a 1. If bearish divergence is found at the current bar, the value of 1 is passed by reference back to the variable oBearDiv. If bullish divergence is found at the current bar, the value of 1 is passed by reference back to the variable oBullDiv. UsageThe AlchemyPivDivergence function checks for corresponding swing points between price and an indicator and evaluates if the most recent swing high or swing low values are moving in opposite directions. |