JustUncleL

Candlestick Trend Indicator v0.2 by JustUncleL

This updated version cleans up the candlestick patterns used, now only use Engulfing and Harami named patterns. Also I have now utilised the Price Action Candles from "CM_Price-Action-Bars by ChrisMoody" ,
The new four(4) price action highlighted bar patterns:
Yellow = Inside Bar - breakout/continuance
Orange = Outside Bar - breakout/continuance
Blue/Black = Up/down Pin Bars - Buying/Selling pressure
Aqua/Fuschia = Up/Down Shaved Bars - Buying/Selling pressure

You can switch the PA bars off/on and the original Candlestick named patterns on/off. When both switches on you will get indication doubled up with coloured and named bars.
If you enable Candlestick patterns and disable Price Action candles, then the indicator behaves the same as the original version.
All Bar indicators have been pre-filtered by the ZEMA(20) trend line .
The Price Action candles are particularly well suited to Daily charts and longer term trades.
You can still use the system on lower time frame charts 1hr to 4hr, I would suggest 4 bar expiry for 1hr charts and 1 bar or End of Day for 4hr charts.
Remove from Favorite Scripts Add to Favorite Scripts
//@version2
// Name: Candlestick Trend Indicator v0.1 by JustUncleL
// By: JustUncleL
// Date: 12-Aug-2016
// Version: v0.2
//
// Description:
//   This is a trend following indicator+stategy for Binary Options
//   based on Candlestick patterns and trend line - 
//   NOTE: original system was a forex trading system.
//   This code combines a number of indicators to create an overall
//   trading strategy.
//   The indicator recognises and displays some useful candle patterns.
//   In version 0.2 added price action candles from ChrisMoody,
//   Four(4) price action patterns:
//   Yellow = Inside Bar - breakout/continuance 
//   Orange = Outside Bar - breakout/continuance
//   Blue/Black = Up/down Pin Bars - Buying/Selling pressure
//   Aqua/Fuschia = Up/Down Shaved Bars - Buying/Selling pressure
//   The PA bars can be doubled up with the named bars.
//
//   The highlighted candles (maroon and darker green) are the
//   other patterns that are following the current 
//   trend direction that is indicated by the Zero Lag EMA(20) line,
//   this also generates an alert condition for alarm setting.
//   The fractal upper/lower break lines are also draw, if the last
//   fractal break line is broken by a highlighted bar then this
//   indicates a stronger trend conformation.
//   Confirm entry via MACD DEUTER 2 colour(5,15,1), the MACD histogram
//   same colour as hightlighted bar - needs "MACD DEUTER 2 colour" indicator.
//
//   This multi-indicator set up is suitable for 1hr, 4hr and daily charts 
//   with 1-4 candle expiry.
//   
// references:
//   - [RS]Fractal Levels  by RicardoSantos
//   - Almost Zero Lag EMA [LazyBear]
//   - Candlestick Patterns With EMA by rmwaddelljr
//   - CM_Price-Action-Bars by ChrisMoody
//   - http://www.forexstrategiesresources.com/candlestick-forex-strategies/1-candlestick-trend/
//
//
// Modifications:
//  0.2 - removed all candle patterns except Harami and Engulfing candle patterns.
//        Added and highlighted price action candles from CM for extra indication.
//        Changed default ZEMA length from 15 to 20.
//        Bug fixes. (14-Aug-2016)
//  0.1 - original beta release.
//
study(title="Candlestick Trend Indicator v0.2 by JustUncleL", shorttitle="CDLTRD v0.2 by JustUncleL", overlay=true, scale=scale.right)
//
// this section based on Almost Zero Lag EMA [LazyBear]
length = input(20,minval=2,title="Length ZeroLagEMA")
src=close
ema1=ema(src, length)
ema2=ema(ema1, length)
d=ema1-ema2
zlema=ema1+d
col =  zlema > zlema[1] ? green : red
up = zlema > zlema[1] ? 1 : 0
down = zlema < zlema[1] ? 1 : 0
plot(zlema,color=col, style=line, linewidth=4, transp=0)

// Find all Fractals.
// This section based on [RS]Fractal Levels  by RicardoSantos
hidefractals = input(false)
hidelevels = input(false)
topfractal = high[2] > high[1] and high[2] > high and high[2] > high[3] and high[2] > high[4]
botfractal = low[2] < low[1] and low[2] < low and low[2] < low[3] and low[2] < low[4]

plotshape(hidefractals ? na : topfractal, color=green, transp=0, style=shape.triangleup, location=location.abovebar, offset=-2, size=size.tiny)
plotshape(hidefractals ? na : botfractal, color=red, transp=0, style=shape.triangledown, location=location.belowbar, offset=-2, size=size.tiny)

topfractals = topfractal ? high[2] : topfractals[1]
botfractals = botfractal ? low[2] : botfractals[1]

topfcolor = topfractals != topfractals[1] ? na : green
botfcolor = botfractals != botfractals[1] ? na : red

plot(hidelevels ? na : topfractals, color=topfcolor, transp=0, linewidth=2)
plot(hidelevels ? na : botfractals, color=botfcolor, transp=0, linewidth=2)

//
// This section based on Candlestick Patterns With EMA by rmwaddelljr
uhb = input(true, title="Use Candlestick Trend Bars")

//
// This section based on CM_Price-Action-Bars by ChrisMoody
// Change the pin bar calculation, so can be used for market direction.
pctP = input(66, minval=1, maxval=99, title="Percentage Input For PBars, What % The Wick Of Candle Has To Be")
pctS = input(5, minval=1, maxval=99, title="Percentage Input For Shaved Bars, Percent of Range it Has To Close On The Lows or Highs")
pab = input(true, title="Use Price Action Trend Bars")
sgb = input(false, title="Check Box To Turn Bars Gray?")

//PBar Percentages
pctCp = pctP * .01
pctCPO = 1 - pctCp

//Shaved Bars Percentages
pctCs = pctS * .01
pctSPO = pctCs

range = high - low

///PinBars
pBarUp = pab and open > high - (range * pctCPO) and close > high - (range * pctCPO) ? 1 : 0
pBarDn = pab and open < high - (range *  pctCp) and close < high-(range * pctCp) ? 1 : 0

//Shaved Bars
sBarUp   = pab and (close >= (high - (range * pctCs)))
sBarDown = pab and close <= (low + (range * pctCs))

//Inside Bars
insideBar = pab and high <= high[1] and low >= low[1] ? 1 : 0
outsideBar= pab and (high > high[1] and low < low[1]) ? 1 : 0


//PinBars
barcolor(pBarUp and down? blue : na)
barcolor(pBarDn and up? black : na)

//Shaved Bars
barcolor(sBarDown and down ? fuchsia : na)
barcolor(sBarUp and up ? aqua : na)

//Inside and Outside Bars
barcolor(insideBar and (up or down)? yellow : na )
barcolor(outsideBar and (up or down) ? orange : na )

beh = uhb and (close[1] > open[1] and open > close and open <= close[1] and open[1] <= close and open - close < close[1] - open[1] )
plotshape(beh, title= "Bearish Harami",  color=red, style=shape.arrowdown, text="Bear\nHarami")

blh = uhb and (open[1] > close[1] and close > open and close <= open[1] and close[1] <= open and close - open < open[1] - close[1] )
plotshape(blh,  title= "Bullish Harami", location=location.belowbar, color=green, style=shape.arrowup, text="Bull\nHarami")

bee = uhb and (close[1] > open[1] and open > close and open >= close[1] and open[1] >= close and open - close > close[1] - open[1] )
plotshape(bee,  title= "Bearish Engulfing", color=red, style=shape.arrowdown, text="Bearish\nEngulf")

ble = uhb and (open[1] > close[1] and close > open and close >= open[1] and close[1] >= open and close - open > open[1] - close[1] )
plotshape(ble, title= "Bullish Engulfing", location=location.belowbar, color=green, style=shape.arrowup, text="Bullish\nEngulf")


//
barcolor(beh and down ? maroon : na)
barcolor(bee and down ? maroon : na)
barcolor(ble and up ? lime : na)
barcolor(blh and up ? lime : na)
//
barcolor(sgb and close ? gray : na)


//
barAlert = ((bee or beh or pBarUp or insideBar or outsideBar or sBarDown) and down) or ((ble or blh or pBarDn or insideBar or outsideBar or sBarUp) and up)
alertcondition(barAlert,title="CDLTRD Alert", message="CDLTRD Bar Alert")

//EOF
Hi, please be advised the PinBar price action calculation should be changed to:

///PinBars Long Upper Shadow represent selling pressure
pBarDn = pab and open < high - (range * pctCp) and close < high - (range * pctCp) ? 1 : 0
///PinBars with Long Lower Shadow represent buying pressure
pBarUp = pab and open > low + (range * pctCp) and close > low + (range * pctCp) ? 1 : 0

and bar drawing to:

//Long shadow PinBars supporting market direction
barcolor(pBarDn and down? black : na)
barcolor(pBarUp and up? blue : na)

The original calculation by CM was designed for reversal PinBars and does not represent the right pattern for trend support.
The new PinBar calculation represents the correct trend direction support.

This correction will be included in the next release (0.3), which I should in the next day or so.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
日本
한국
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