DYO: Keltner inside Bollinger example


Q:  Can you help me with a DYO that does the following:

Red dot:  When upper BB is below upper Keltner Channel, and lower BB band is above lower Keltner channel.
Green dot for the opposite, mainly:  When upper BB is above upper Keltner Channel, and lower BB band is below lower Keltner channel

Incidentally, what does # refer to ?   Is it the GV ?   In the line C and D, what does Value and [2] refer to ?

A:

Global Variables (GV) are just temporary places to store values.  So Lines A through D read the study band values and park them in GV [1] through [4].   Now they are available for testing in Lines E though J.

Line F reads the Value in Read GV [1]  which is the Bol Upper Band and compares it to the content of the [3] which is the Kel Upper Band. This is a Boolean test that is True or False and the result is stored in GV [5] for use later on.

Line G is the test for the Bol Lower Band being below the Kel Lower Band.   This result is stored in GV [6] for use later on.

Line H now does the AND operation on [5] and [6], the set size for the AND is the number 2 and the set begins in position 5 from the Read GV value. When the result of AND between [5] and [6] is True, the Green dot is plotted.

Lines H, I, and J are the mirror image to the logic to test for both Bol bands to be inside of the Kel bands, and show a Red dot when this is the case.  As shown on the chart, nothing is drawn when the bands are in transition between being fully inside or fully outside.


Last modified 1/31/08 2:26 PM