Home    |    Trading Alchemy Manual    |    Alchemy Functions Index

AlchemyMultOscHkDiv (Function)

AlchemyMultOscHkDiv is a multiple-output function that provides the calculation of Bearish and Bullish Divergence between price and 2 oscillators.  The first oscillator can be specified to require a minimum hook slope.  Additionally to the AlchemyMultOscDiv function, AlchemyMultOscHkDiv also passes the hook bar numbers.

AlchemyMultOscHkDiv (BullBear, HiPrice, LoPrice, NumOsc, Osc1, Osc2, MinHook, DivPrDi, DivOsc1Di, DivOsc2Di, Osc1LagLen, MaxOsc2Offset, MinDivLen, MaxDivLen, MaxDivPiv, DivPrPivBrk, DivPrPivBrkDi, DivOsc1PivBrk, DivOsc1PivBrkDi, DivOsc2PivBrk, DivOsc2PivBrkDi, DivPrPivClear, DivPrPivClearDi, DivOsc1PivClear, DivOsc1PivClearDi, DivOsc2PivClear, DivOsc2PivClearDi, oOsc1Peak, oOsc1DownHookBar, oBearDivPeak, oDivPriceHi, oDivPriceHiBar, oDivOsc1Hi, oDivOsc1HiBar, oDivOsc2Hi, oDivOsc2HiBar, oPivPriceHi, oPivPriceHiBar, oPivOsc1Hi, oPivOsc1HiBar, oPivOsc2Hi, oPivOsc2HiBar, oOsc1Trough, oOsc1UpHookBar, oBullDivTrough, oDivPriceLo, oDivPriceLoBar, oDivOsc1Lo, oDivOsc1LoBar, oDivOsc2Lo, oDivOsc2LoBar, oPivPriceLo, oPivPriceLoBar, oPivOsc1Lo, oPivOsc1LoBar, oPivOsc2Lo, oPivOsc2LoBar)

Parameters

 

BullBear

A positive value looks for bullish divergence only.  A negative value looks for bearish divergence only.  0 looks for both bullish and bearish divergence.

HiPrice

Specifies the price value for bearish divergence.

LoPrice

Specifies the price value for bullish divergence.

NumOsc 1 uses only Osc1 for divergence, greater than 1 uses both, Osc1 and Osc2 for divergence. 
Osc1 Specifies the values for the first oscillator to use.
Osc2 Specifies the values for the second oscillator to use.

MinHook

Specifies the minimum hook slope for the first oscillator.

DivPrDi

Specifies the minimum amount by which the divergent price needs to break the price pivot it is compared to.  A negative value allows for the divergent price to be shy of the price pivot it is compared to. 

DivOsc1Di

Specifies the minimum amount by which the divergent Osc1 needs to fail the Osc1 pivot it is compared to. 

DivOsc2Di

Specifies the minimum amount by which the divergent Osc2 needs to fail the Osc2 pivot it is compared to. 

Osc1LagLen

Specifies the maximum number of lagging bars between price and Osc1 pivot

MaxOsc2Offset

Specifies the maximum number of bars between price and Osc2 pivot

MinDivLen

Specifies the minimum number of trailing bars to consider

MaxDivLen

Specifies the maximum number of trailing bars to consider, 0 allows for an indefinite number of trailing bars

MaxDivPiv Specifies the maximum number of pivots
DivPrPivBrk Enables/disables requirement that disqualifies two price pivots that are compared to each other for divergence, if there are price pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the divergent price pivot
DivPrPivBrkDi Specifies the amount that disqualifies two price pivots that are compared to each other for divergence, if there are price pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the divergent price pivot
DivOsc1PivBrk Enables/disables requirement that disqualifies two Osc1 pivots that are compared to each other for divergence, if there are Osc1 pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the divergent Osc1 pivot
DivOsc1PivBrkDi Specifies the amount that disqualifies two Osc1 pivots that are compared to each other for divergence, if there are Osc1 pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the divergent Osc1 pivot
DivOsc2PivBrk Enables/disables requirement that disqualifies two Osc2 pivots that are compared to each other for divergence, if there are Osc2 pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the divergent Osc2 pivot
DivOsc2PivBrkDi Specifies the amount that disqualifies two Osc2 pivots that are compared to each other for divergence, if there are Osc2 pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the divergent Osc2 pivot
DivPrPivClear Enables/disables requirement that disqualifies two price pivots that are compared to each other for divergence, if there are price pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the price pivot the divergence is measured against.
DivPrPivClearDi Specifies the amount that disqualifies two price pivots that are compared to each other for divergence, if there are price pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the price pivot the divergence is measured against.
DivOsc1PivClear Enables/disables requirement that disqualifies two Osc1 pivots that are compared to each other for divergence, if there are Osc1 pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the Osc1 pivot the divergence is measured against.
DivOsc1PivClearDi Specifies the amount that disqualifies two Osc1 pivots that are compared to each other for divergence, if there are Osc1 pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the Osc1 pivot the divergence is measured against.
DivOsc2PivClear Enables/disables requirement that disqualifies two Osc2 pivots that are compared to each other for divergence, if there are Osc2 pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the Osc2 pivot the divergence is measured against.
DivOsc2PivClearDi Specifies the amount that disqualifies two Osc2 pivots that are compared to each other for divergence, if there are Osc2 pivots in between that are higher for bearish divergence or lower for bullish divergence by specified amount from the Osc2 pivot the divergence is measured against.
oOsc1Peak Variable that receives 1 if a bearish divergence peak is formed
oOsc1DownHookBar Variable that receives the bar number of the down hook
oBearDivPeak Variable that receives the number of pivots back to which the bearish divergence is measured against
oDivPriceHi Variable that receives the value of the bearish divergence price
oDivPriceHiBar Variable that receives the bar number of the bearish divergence price
oDivOsc1Hi Variable that receives the value of the bearish divergence Osc1
oDivOsc1HiBar Variable that receives the bar number of the bearish divergence Osc1
oDivOsc2Hi Variable that receives the value of the bearish divergence Osc2
oDivOsc2HiBar Variable that receives the bar number of the bearish divergence Osc2
oPivPriceHi Variable that receives the value of the price to which the bearish divergence is compared to
oPivPriceHiBar Variable that receives the bar number of the price to which the bearish divergence is compared to
oPivOsc1Hi Variable that receives the value of Osc1 to which the bearish divergence is compared to
oPivOsc1HiBar Variable that receives the bar number of Osc1 to which the bearish divergence is compared to
oPivOsc2Hi Variable that receives the value of Osc2 to which the bearish divergence is compared to
oPivOsc2HiBar Variable that receives the bar number of Osc2 to which the bearish divergence is compared to
oOsc1Trough Variable that receives 1 if a bullish divergence trough is formed
oOsc1UpHookBar Variable that receives the bar number of the up hook
oBullDivTrough Variable that receives the number of pivots back to which the bullish divergence is measured against
oDivPriceLo Variable that receives the value of the bullish divergence price
oDivPriceLoBar Variable that receives the bar number of the bullish divergence price
oDivOsc1Lo Variable that receives the value of the bullish divergence Osc1
oDivOsc1LoBar Variable that receives the bar number of the bullish divergence Osc1
oDivOsc2Lo Variable that receives the value of the bullish divergence Osc2
oDivOsc2LoBar Variable that receives the bar number of the bullish divergence Osc2
oPivPriceLo Variable that receives the value of the price to which the bullish divergence is compared to
oPivPriceLoBar Variable that receives the bar number of the price to which the bullish divergence is compared to
oPivOsc1Lo Variable that receives the value of Osc1 to which the bullish divergence is compared to
oPivOsc1LoBar Variable that receives the bar number of Osc1 to which the bullish divergence is compared to
oPivOsc2Lo Variable that receives the value of Osc2 to which the bullish divergence is compared to
oPivOsc2LoBar Variable that receives the bar number of Osc2 to which the bullish divergence is compared to

 

Returns

AlchemyMultOscHkDiv returns 1 when bullish divergence is found and returns -1 when bearish divergence is found.  The values of BullBear, HiPrice, LoPrice, NumOsc, Osc1, Osc2, MinHook, DivPrDi, DivOsc1Di, DivOsc2Di, Osc1LagLen, MaxOsc2Offset, MinDivLen, MaxDivLen, MaxDivPiv, DivPrPivBrk, DivPrPivBrkDi, DivOsc1PivBrk, DivOsc1PivBrkDi, DivOsc2PivBrk, DivOsc2PivBrkDi, DivPrPivClear, DivPrPivClearDi, DivOsc1PivClear, DivOsc1PivClearDi, DivOsc2PivClear, DivOsc2PivClearDi, oOsc1Peak, oOsc1DownHookBar, oBearDivPeak, oDivPriceHi, oDivPriceHiBar, oDivOsc1Hi, oDivOsc1HiBar, oDivOsc2Hi, oDivOsc2HiBar, oPivPriceHi, oPivPriceHiBar, oPivOsc1Hi, oPivOsc1HiBar, oPivOsc2Hi, oPivOsc2HiBar, oOsc1Trough, oOsc1UpHookBar, oBullDivTrough, oDivPriceLo, oDivPriceLoBar, oDivOsc1Lo, oDivOsc1LoBar, oDivOsc2Lo, oDivOsc2LoBar, oPivPriceLo, oPivPriceLoBar, oPivOsc1Lo, oPivOsc1LoBar, oPivOsc2Lo, oPivOsc2LoBar are passed by reference back to the calling function or technique

Usage

The AlchemyMultOscDiv function checks for corresponding swing points between price and two oscillators and evaluates if the most recent swing high or swing low values are moving in opposite directions.  It then uses a down hook or up hook to trigger a divergence signal.

Home    |    Trading Alchemy Manual    |    Alchemy Functions Index