A Simple Bollinger Band Trading Model

Bollinger Bands have quickly become one of the most commonly used tools in technical analysis. Bollinger Bands consist of three bands – an upper, middle and lower band – that are used to spotlight extreme short-term prices in a security. The upper band represents overbought territory, while the lower band can show you when a security is oversold. Most technicians will use Bollinger Bands in conjunction with other analysis tools.

A simple BBand strategy is buying stocks that break the lower Bollinger Band. It is expected that the price of the stock will revert back above the lower band and head toward the middle band.

You can build you own Bollinger Band based strategy that scans all the Nifty 50 stocks for a potential break using the StockViz Technical API in a few lines of code.

# get the index constituents and loop through them
constituents = common.getConstituents("CNX NIFTY") 

for cc in cleanConsts:
     ticker = cc["SYMBOL"]
     # get the latest technicals
     techs = common.getTechnicals(ticker) 
     t = techs[len(techs)-1]
     # get the latest price
     price = common.getLivePrice(ticker)

     #make the decision
     if t["BB_DN"] > price:
		#there was a breakdown

		print "Buy:", ticker
		common.placeTrade(ticker, 1, "buy")

You can read the whole code on GitHub

Source: investopedia


Comments are closed, but trackbacks and pingbacks are open.