Candlestick Trend Indicator v0.3 by JustUncleL

This updated version has included a number of improvements and corrections, this will probably be the last release unless a major error is detected.
I have now set up the defaults to show the easiest and probably most useful chart settings to use. Even though the indicator still includes the Price Action candles from Chris Moody, they are disabled by default and can know be enabled individually. Before utilising the PA bars I would suggest at least look at the video specified in Chris Moody's script "CM_Price-Action-Bars by ChrisMoody".

Modifications in this version (0.3):
- Corrected PinBar calculation for trend direction support.
- Modified Engulfing and Harami candles calculations to follow more accurately
their definitions.
- Added optional reversal pin bars (red/green bars), so possible change in
direction can be identified, only use this when using the Price Action Candle
patterns "Red/Green = Possible reversal PinBars - Reverse Down / reverse Up".
- Added option to show only bar patterns that are supporting current trend.
- Added option to enable Price action bars individually, all disabled by default.
- Corrected and returned Dark Cloud Cover, Piecing Line and Pin Bars back into
the named candle patterns (they were not working in v0.1).

Some Hints for using this indicator and chart set up:
- Don't use the Price action bars unless you understand them. You will get plenty
of good entries from the default set up. Probably better to use PA bars or
named bar patterns, but not together otherwise chart looks very busy.
- Don't trade near nor directly after major market news (sometime better no trade day).
- High probability trades occur when the MACD passes through zero or a few bars after,
so look for candle pattern alert or the bar passing through the last Fractal
break line in direction of trend.
- Do not trade when the MACD is flat and close to the zero line, this indicates a
ranging market.
- You can add optional EMA (20) trend line , when ZEMA(20) above EMA (20) trade calls only,
when ZEMA(20) below EMA (20) trade puts only. The crosses also normally act as a
confirmation of trend direction changing.
- The indicator should be effective on forex pairs, commodities and even indices
but stick to just a few major ones and practise them, suggested expiries are:
15min Chart use 1hr expiry.
30min & 1hr Charts use 4hr or end of day expiry.
4hr charts use end of day or end of next day expiry.
Daily charts end of week or even longer.
- When looking for End of Day positions, start looking for a MACD zero cross with matching
alert or Fractal break after the London session starts.
- Please practise this system in DEMO first, before committing real money. Be patient
the more you practise the better and more confident you will be.

I hope you enjoy this indicator, it has proven very useful and effective for me. It is now my indicator I use on a daily basis.
Remove from Favorite Scripts Add to Favorite Scripts
// Name: Candlestick Trend Indicator v0.1 by JustUncleL
// By: JustUncleL
// Date: 12-Aug-2016
// Version: v0.3
// 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
//   Aqua/Fuschia = Up/Down Shaved Bars - Buying/Selling pressure
//   Red/Green = Possible reversal PinBars - Reverse Down / reverse Up.
//   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.3 - Corrected PinBar calculation for trend direction support.
//        Modified Engulfing and Harami candles calculatios to be more accurately identified.
//        Added optional reversal pin bars (red/green bars), so possible change in 
//        direction can be identified, this not part of the original alert though.
//        Added option to show only bar patterns that are supporting current trend.
//        Added option to enable Price action bars individually.
//        Returned Dark Cloud Cover, Piecing Line and Pin Bars back into the named
//        candle patterns.
//  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.3 by JustUncleL", shorttitle="CDLTRD v0.3 by JustUncleL", overlay=true, scale=scale.right)
// this section based on Almost Zero Lag EMA [LazyBear]
length = input(20,minval=2,title="Length ZeroLagEMA")
ema1=ema(src, length)
ema2=ema(ema1, length)
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="Directional PBars, % of Range of Candle the Long Wick Has To Be")
pctS = input(5, minval=1, maxval=99, title="Shaved Bars, % of Range it Has To Close On The Lows or Highs")
upb = input(false, title="Use Price Action Pin Bars")
usb = input(false, title="Use Price Action Shaved Bars")
uob = input(false, title="Use Price Action Outside Bars")
uib = input(false, title="Use Price Action Inside Bars")
spb = input(false, title="Show Reversal Pin Bars")
pctRP = input(72, minval=1, maxval=99, title="Reversal PBars, % of Range of Candle the Long Wick Has To Be")
pblb =input(6,minval=1,title="Reversal Pin Bar Lookback Length")
sgb = input(false, title="Check Box To Turn Bars Gray")
stnd = input(true, title="Show Only Patterns Following Trend")

//PBar Percentages
pctCp = pctP * .01

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

range = high - low

///Reversal PinBars
pctCRp = pctRP * .01
pctCRPO = 1 - pctCRp
pBarRUp= spb and open > high - (range * pctCRPO) and close > high - (range * pctCRPO) and low <= lowest(pblb) ? 1 : 0
pBarRDn = spb and open < high - (range *  pctCRp) and close < high-(range * pctCRp) and high >= highest(pblb) ? 1 : 0

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

//Inside Bars
insideBarUp = uib and (high < high[1] and low > low[1])
insideBarDn = uib and (high < high[1] and low > low[1])
outsideBarUp= uob and (high > high[1] and low < low[1])
outsideBarDn= uob and (high > high[1] and low < low[1])

// PinBars representing possible change in trend direction
barcolor(pBarRUp ? green : na)
barcolor(pBarRDn ? red : na)

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

//Inside and Outside Bars
barcolor((insideBarUp and (not stnd or up)) or (insideBarDn and (not stnd or down))? yellow : na )
barcolor((outsideBarUp and (not stnd or up)) or (outsideBarDn and (not stnd or down)) ? orange : na )

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

//Long shadow PinBars supporting market direction
//barcolor(pBarDn and (not stnd or down)? black : na)
plotshape(pBarDn and (not stnd or down), title= "Bearish Pin Bar",  color=red, style=shape.arrowdown, text="Bearish\nPinBar")
//barcolor(pBarUp and (not stnd or up)? teal : na)
plotshape(pBarUp and (not stnd or up),  title= "Bullish Pin Bar", location=location.belowbar, color=green, style=shape.arrowup, text="Bullish\nPinBar")

dcc = uhb 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(dcc and (not stnd or down), title="Dark Cloud Cover",text='DarkCloud\nCover',color=red, style=shape.arrowdown,location=location.abovebar)

pln= uhb 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(pln and (not stnd or up), title="Piercieng Line",text="Piercing\nLine",color=green, style=shape.arrowup,location=location.belowbar)

beh = uhb and (close[1] > open[1] and open > close and open <= close[1] and low >= open[1] and open - close < close[1] - open[1] and (high < high[1] and low > low[1]))
plotshape(beh and (not stnd or down), 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 high <= open[1] and close - open < open[1] - close[1] and (high < high[1] and low > low[1]))
plotshape(blh and (not stnd or up),  title= "Bullish Harami", location=location.belowbar, color=green, style=shape.arrowup, text="Bull\nHarami")

bee = uhb and (close[1] > open[1] and close < open and close<=low[1] and open>= close[1])
plotshape(bee and (not stnd or down),  title= "Bearish Engulfing", color=red, style=shape.arrowdown, text="Bearish\nEngulf")

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

//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)

barcolor(beh and down ? maroon : na)
barcolor(bee and down ? maroon : na)
barcolor(dcc and down ? maroon : na)
barcolor(pBarDn and down ? maroon : na)
barcolor(ble and up ? lime : na)
barcolor(blh and up ? lime : na)
barcolor(pln and up ? lime : na)
barcolor(pBarUp and up ? lime : na)
barcolor(sgb and close ? gray : na)

barAlert = ((bee or beh or pBarDn or insideBarDn or outsideBarDn or sBarDown or dcc) and down) or ((ble or blh or pBarUp or insideBarUp or outsideBarDn or sBarUp or pln) and up)
alertcondition(barAlert,title="CDLTRD Alert", message="CDLTRD Bar Alert")

Nice work! Thanks for sharing! Very useful tools.
JustUncleL PRO coondawg71
Thank you, I believe this indicator is one of my best tools and should also work well with Forex (Take Profit, Stop Loss...) style trades, I will convert it into a "Strategy" project, for Forex trades, at some stage.
@JustUncleL I think this is it! I'm gonna test it through the week. Thanks very much.
Another hint: don't trade every alert only the best will do this will take practice, the candles with shorter wicks and good size bodies tend to be be better, but not the huge ones they normally happen on market news and tend to exhaust.
fbatistat PRO JustUncleL
Muchas gracias @JustUncleL! I will have that in mind when it comes to the entry signal.
May I have access please?
@clos, This indicator is open source and not locked.
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