New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.
reverse engineering bearish engulfing
I'm trying to reverse engineer the code Stockcharts uses for some of their candlesticks. It's quite difficult actually. I usually end up with not enough rules and end up with more candidates than the stockcharts predefined scan. Currently I'm working on the Bearish Engulfing candle and this is what I have:
[exchange is NYSE]
and [group is not ETF]
and [today's open > today's EMA(10, close)]
and [yesterday's close > yesterday's open]
and [today's high > yesterday's close]
and [today's close < today's open]
and [today's open > yesterday's close]
#not shooting star
and [high - open < [open - close]*2]
#not hammer
and [close - low < [open - close]*1]
#closing lower than yesterday's open
and [today's close < yesterday's open]
If you compare my code to the stockcharts predefined scan for bearish engulfing (NYSE) you will see my scan returns more stocks than the stockcharts predefined scan. Any obvious rules I'm missing here?
0
Comments
[exchange is NYSE]
and [group is not ETF]
and [sma(21,volume) > 40000]
and [1 day ago Doji is not true]
and [1 day ago close > 1 day ago open]
and [open > 1 day ago close]
and [close < 1 day ago open]
and [Long Body is true]
How would you do it without using the 'doji' and 'long body' pre-definitions though? I'm trying to get away from using all of stockcharts pre-defined setups so I can port to another program if needed.
Long body could be
and[close > open]
and [close - open > range * .5]
or maybe .6 or .7, .8. .9
For a long body closing down then same thing except open > close, open - close to get positive number comparisons.
There are a few variations of doji, but the main property is a small body, so it would similar to long body, but the multiplier might be .1 or .05. Then if you care about where it happens you would have to place the close somewhere in the range. For a high close
and [close > low + [range * .8] ]
For a low close
and [close < low + [range * .2] ]
Most definitions I've seen don't care about whether the close is above the open, but you could include that test, too, if it helps.
You might also specify something about range if you want a reasonably normal candle for the doji (or the long body, for that matter), like
and [range > ATR(14) * .5]
or some other multiplier.