cegis 235 posts msg #32434  Ignore cegis 
6/25/2004 1:32:30 PM
Prashant,
Just define the parts using Open/High/Low/Close:
The first group of set{} commands determines which value should be used for the top of the body, the open or close. This leaves topopen = 1 if the open should be used (zero otherwise) and topclose = 1 if the close should be used (zero otherwise).
The next group then determines the top value. Since topopen will be 1 when topclose is zero  and vice versa  the multiplications will result in only one of top1 or top2 being greater than zero, with the other equal to zero. So, I can add them together to get the value of the top.
The next group determines the value to use for the bottom of the body. Since this should be the open if the top was the close, or vice versa, I can add the open and close together, then subtract the top to get the bottom (open + close  open = close; open + close  close = open).
The "shadows" are then calculated based on high/top/bottom/low.
The "relative length" of the shadows are calculated next. These are relative to the body length, so a value of 2 would mean the shadow is twice as long as the body.
Lastly, the "size" of the body, relative to the current price, is determined.
The first three conditions, then, are my interpretation of "long shadows" and "narrow body". I've chosen that both shadows need to be at least twice as big as the body, and the body must be less than 5% of the current price.
I also added price and volume criteria that I often use. (I don't like illiquid or penny stocks.)
Lastly, the "add column" statements are for illustration purposes...
Obviously, choose your values to suit your needs...
HTH,
C
