Custom Indicator finds Bullish Candlestick Patterns in Stock Charts

Programming a custom indicator which finds stocks that completed bullish candlestick patterns on last day’s close helps me sort stocks in the Ninja Trader market analyzer, in case I am looking to buy stocks. The indicator compares highs and lows of previous candlesticks with the last candlestick. Average True Range (ATR) and Relative Strength Index (RSI) indicators are also used inside the indicator’s code for better screening, although they are not necessary. The custom indicator, which obviously can be used for stock and forex trading alike, returns “1” for any stock which formed a bullish candlestick pattern at last day’s bar, otherwise the stock price is shown.


Bullish Candlestick Pattern at OVTI stock chart

At first I was worried I wouldn’t be able to learn Ninja Trader’s programming language. Since working with Metastock I wasn’t that fond of learning yet another programming language. However Ninja Trader was proven very easy software when it comes to programming custom indicators and trading strategies. The NinjaScript, as they call it, is compiled by itself as you choose the filters and criteria for your indicator. You can of course compile it yourself and ignore those options, but for any trader who has just started using Ninja Trader it’s perfect.

So, this indicator looks for the following parameters to point out a bullish candlestick pattern:

  • Last day candlestick: Green candlestick (close>open) indicating a gaining day for the stock. The close, high and low must all be higher than last day’s corresponding values. Additionally the high needs to be new high of last 2 days.
  • Previous candlestick: The high and low need to be lower than previous day’s high and low, while the close must also be lower than open, indicating a strong selling day.
  • 2 days ago candlestick: Open higher than close, meaning a red falling candlestick.

The rest of the filters include the [intlink id=”1893″ type=”post”]RSI indicator[/intlink], which should be less than a user-defined variable (RSIno). When you test the indicator, setting an RSIno figure of 30 would mean to look for oversold stocks apart from the bullish pattern. “Volumeshares” is another variable where you set the minimum volume of a stock to be sorted out using this custom indicator. Most traders like to trade stocks with at least 1 million traded shares, so that would be my choice as well. Finally, the formula about the ATR indicator looks for stocks that are about to start trending or reverse their trend. A low ATR figure is usually a sign of an emerging trend, given the fact there are other positive indications for such an event. A bullish candlestick pattern is certainly a very strong indication!


Bullish Candlestick Pattern at Support Level of Trendline (EBAY stock)

Download the custom indicator and import it to your Ninja Trader software. Combining the custom indicator with other technical analysis’ indicators and theories such as support and resistance levels will most probably return much better results. Personally I include the ATR, RSI and the custom indicator in Ninja Trader Market Analyzer when I [intlink id=”2200″ type=”post”]get the free stock quotes[/intlink] in the morning. When the list is populated with the data, I sort by the custom indicator and I need to focus on just a few of the stocks. The custom indicator can easily be reverted in case you are looking to short sell instead of buy stocks, so you should be looking for bearish candlestick patterns!