DYO: Inside Hamari candle body example
|
Q: Can you help with a DYO that would test for and show a Hamari candle body which is entirely inside the range of a prior candle body, possibly 2 or 3 bars back? The body must be entirely engulfed by the prior candle body. The Opens and Closes of the two bars cannot be equal.
A: Here is the solution for a bar's candle body being engulfed by the bar 2 bars to the left.
Line A and B Bar Offset of -2 controls which bar the test occurs with. Change the -2 to a -3 to compare with the 3rd bar to the left of a bar being tested.
Line C and D are used to order the earlier bar's Open and Close, so the lower price is in GV[1] and the higher price is in GV[2].
Lines E through H are the 4 needed tests. The lower price in [1] of the earlier bar needs to be below both the Open and the Close of the current bar. And, the higher price in [2] of the earlier bar needs to be above both the Open and the Close of the current bar.
When all 4 conditions are True, Line I will use the Color Bar marker to color the engulfed bar red.
Template: 1278-Hamari
Last modified 1/21/08 10:40 AM
|