Price Action Candles v0.1 by JustUncleL

This script was created by request. It finds major price action bars, each pattern can be turned off/on individually.
NOTE: This is a Beta release, if you find errors please comment.
Remove from Favorite Scripts Add to Favorite Scripts
// Name: Price Action Candlesticks v0.1 by JustUncleL
// By: JustUncleL
// Date: 16-Aug-2016
// Version: v0.1
// Description:
//   Identifies the candlestick patterns as used in
//   "Price Action Battle Station by theforexguy". All the identification 
//   of PA candles is dissabled by default.
//   The patterns identified are:
//   - Dark Cloud Cover : large body bull candle followed by large body
//       bear candle that covers the upper bull candle and closes in the
//       lower 50% of bull body.
//   - Piecing Line : large body bear candle followed by large body
//       bull candle that covers the lower bear candle and closes in the
//       upper 50% of bear body.
//   - Doji (aka spinning top): small or no body candle with wicks top and 
//       bottom that are at least 30% of candle.
//   - Bullish Engulfing: a bear candle followed by a larger bull candle
//       whose body covers the bear candle including the upper wick.
//   - Bearish Engulfing: a bull candle followed by a larger bear candle
//       whose body covers the bull candle including the lower wick.
//   - Outside Bar: a small inner candle followed by a large outer candle. 
//       The outer candle covers the whole inner candle (wick to wick)
//   - Outside Bar: a large inner candle followed by a small outer candle. 
//       The inner candle covers the whole outer candle (wick to wick)
//   - Upper Shadow Pin Bar (aka shooting star, inverted hammer, bull rejection) : 
//       a small body bear (red) candle followed which has a large upper wick
//       and a small lower wick.
//   - Lower Shadow Pin Bar (aka hammer, hanging man, bear rejection) : 
//       a small body bull (green) candle followed which has a large lower wick
//       and a small upper wick.
// references:
//  - Inside/Outside Bars and Pin Barsome calculations based on
//        "CM_Price-Action-Patterns Price Bars That Work! by chrismoody"
//  - Other candles, although they all needed correcting, based on
//        "All Candlestick Pattern identifier by alona.gz"
study(title = "Price Action Candles v0.1 by JustUncleL", overlay = true)

sdc = input(false,title="Show Dark Cloud Cover")
spl = input(false,title="Show Piecing Line")
sdj = input(false,title="Show Doji")
sble = input(false,title="Show Bullish Engulfing")
sbre = input(false,title="Show Bearish Engulfing")
sosb = input(false,title="Show Outside Bars")
sisb = input(false,title="Show Inside Bars")
supp = input(false,title="Show Upper Shadow Pin Bar")
sdnp = input(false,title="Show Lower Shadow Pin Bar")

range = high - low

darkCloud=sdc and (close[1]>open[1] and abs(close[1]-open[1])/range[1]>=0.7 and close<open and abs(close-open)/range>=0.7 and open>=close[1] and close>open[1] and close<((open[1]+close[1])/2))
plotshape(darkCloud,title="Dark Cloud Cover",text='DarkCloud\nCover',color=red, style=shape.arrowdown,location=location.abovebar)

piecingLine=spl and (close[1]<open[1] and abs(open[1]-close[1])/range[1]>=0.7 and close>open and abs(close-open)/range>=0.7 and open<=close[1] and close<open[1] and close>((open[1]+close[1])/2))
plotshape(piecingLine,title="Piercieng Line",text="Piercing\nLine",color=green, style=shape.arrowup,location=location.belowbar)

doji=sdj and (abs(close-open)/(high-low)<0.1 and (high-max(close,open))>(0.3*range) and (min(close,open)-low)>(0.3*range))
plotshape(doji,title="Doji",text='Doji',color=fuchsia, style=shape.circle,location=location.belowbar)

bullishEngulf=sble and (close[1]<open[1] and close>open and close>=high[1] and open<=close[1])
plotshape(bullishEngulf,title="Bullish Engulfing",text='Bullish\nEngulfing',color=green, style=shape.arrowup,location=location.belowbar)

bearishEngulf=sbre and (close[1]>open[1] and close<open and close<=low[1] and open>=close[1])
plotshape(bearishEngulf,title="Bearish Engulfing",text='Bearish\nEngulfing',color=red, style=shape.arrowdown,location=location.abovebar)

//Inside Bars
insideBar = sisb and (high < high[1] and low > low[1])
outsideBar= sosb and (high > high[1] and low < low[1])

//Inside and Outside Bars
//barcolor(insideBar and (up or down)? yellow : na )
//barcolor(outsideBar and (up or down) ? orange : na )
plotshape(insideBar,title="Inside Bar",text="Inside\nBar",color=green, style=shape.arrowup,location=location.belowbar)
plotshape(outsideBar,title="Outside Bar",text="Outside\nBar",color=red, style=shape.arrowdown,location=location.abovebar)

//PBar Percentages
pctP = input(70, minval=1, maxval=99, title="Reversal PBars, % of Range of Candle the Long Wick Has To Be")
pctCp = pctP * .01

///PinBars Long Upper Shadow represent selling pressure
pBarUp = supp and (open>close and open < (high - (range * pctCp)) and close < (high - (range * pctCp)))
///PinBars with Long Lower Shadow represent buying pressure
pBarLo = sdnp and (open<close and open > (low + (range * pctCp)) and close > (low + (range * pctCp)))

plotshape(pBarUp,title="Upper Shadow Pin Bar",text='Upper Shadow\nPinBar',color=red, style=shape.arrowdown,location=location.abovebar)
plotshape(pBarLo,title="Lower Shadow Pin Bar",text='Lower Shadow\nPinBar',color=green, style=shape.arrowup,location=location.belowbar)

Ideas Scripts Chart
United States
United Kingdom
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out