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.
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!
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!
Hi Jim,
I understand perfectly the constrution of your indication in Ninja Script.
So, in Market analizer I only have two columns ( Instruments and your indicator -« MycustomIndicator2». The point is that the data I see in the colunm of the indicator is the price of the close of all stocks of the list, and I supose that I sould view only the stocks with the defined pattern. ( I already add other colunms as RSI, and I still continue to see all the sotcks). Certanly I have found something…
Thanks for the help.
Luis
EDIT: Sorry Jim, ignore my last comment!
I had miss this in your post: «returns “1” for any stock which formed a bullish candlestick pattern at last day’s bar, otherwise the stock price is shown.»
Yeap, that’s correct. I was just about to point that out! You can change that into anything you like, by editing the indicator’s script. I opted for the actual stock price, in order to sort them from lowest to highest, apart from the bullish pattern. Hope that makes sense.