jayy

Colored Candles Trend Strength Leaf_West style Jayy

184 2 11
First and most importantly: For this script I have used the relatively new "plotcandle" feature. YOU MUST TURN OFF THE BUILT IN CANDLES/BARS at the top of the screen.
If you don't know how to hide the built-in candles/bars and need help message me.

This is candle coloring as per Leaf_West : http://tradingwithleafwest.net/?page_id=1893.
Elsewhere I have published the Leaf West style ADX which is described in the educational info on Leaf West's site.
This is my attempt to replicate Leaf_West's colored candles indicator.
If you want to know how to use the colored candles and what the colors mean
see the three pdfs at the above direct link to Leaf_West's site. You might also find the "educational " section interesting and relevant. As an example http://tradingwithleafwest.net/?page_id=290 for intraday trading.
I have updated copies of most of my scripts. So if you have downloaded a Leaf West script and it is not functioning the way you like there is a good chance I had the same issue and have updated it but have yet to publish it.
If for whatever reason the pdfs are no longer available then message me.
The inside bars are as per Leaf West also the true inside bars have a triangle beneath them and have a blue ">" above, subsequent bars inside the original candle before the true inside bar have an orange -ish ">".
Outside bars have a capital "O" and a little square             below. These are not from Leaf_West but I did it because most folks looking at inside bars will also want outside bars.
Also for comparison I have added Adam Grimes "free bars". I added Grimes free bars because the concept is very similar to Leaf Wests "exhaustion" light blue candles.
Grimes "free bars" open and close completely outside of the keltner channel as he defines it 2.25 times ATR (14) around a 20 ema.
If you use the "Show Adam Grimes free bars in black?" setting you will also get Adam Grimes
Keltner channel as per: http://adamhgrimes.com/blog/library/indicators/keltner-statistics/
If you have Adam Grimes free bars turned on you likely will cover the exhaustion" light blue candles. You will also see aqua coloured dots above or below the candle if you have Leaf West Colored candles turned on and if the free bar is also a Leaf_West "exhaustion" candle.
You will also get the Keltners channels and 20 ema since Grimes puts it on most of his charts
I have not allowed for changing Adam Grimes keltner channels if you must change the parameters go to lines 76 to 79 or ask me to add a provision to make changes

I could not resist coloring the wicks: green for a bull bar; red for a bear bar (open vs close).
As a reminder this script follows Leaf_West's calculations as closely as possible. However sometimes I had to
guess or use know but possibly outdated parameters. (eg Does Leaf_West still use 3.5 times the ATR(14) around a 16 sma for exhaustion candles and is the trigger a close outside the band or ?) If you have a suggestion
to improve the script let me know.
Cheers
Jayy
Remove from Favorite Scripts Add to Favorite Scripts
//// First and most importantly: For this script I have used the relatively new "plotcandle" feature. 
// YOU MUST TURN OFF THE BUILT IN CANDLES/BARS at the top of the screen.
// If you don't know how to hide the built-in candles/bars and need help message me.

// This is candle coloring as per Leaf_West : http://tradingwithleafwest.net/?page_id=1893.  
// Elsewhere I have published the  Leaf West style ADX which is described in the educational info on Leaf West's site.  
// This is my attempt to replicate Leaf_West's colored candles indicator.
// If you want to know how to use the colored candles and what the colors mean
// see the three pdfs at the above direct link to Leaf_West's site. You might also find the "educational " 
// section interesting and relevant.  As an example http://tradingwithleafwest.net/?page_id=290 for intraday trading.
//  I have updated copies of most of my scripts.  So if you have downloaded a Leaf West script and it is not 
//  functioning the way you like there is a good chance I had the same issue and have updated it but have yet to publish it.
// If for whatever reason the pdfs are no longer available then message me.
// The inside bars are  as per Leaf West also the true inside bars have a triangle beneath them and have a blue ">" 
// above, subsequent bars inside the original candle before the true inside bar have an orange -ish ">". 
// Outside bars have a capital "O" and a little square below.  These are not from Leaf_West but I did it because most
// folks looking at inside bars will also want outside bars.
// Also for comparison  I have added Adam Grimes "free bars".  I added Grimes free bars because the concept is very similar 
// to Leaf Wests "exhaustion" light blue candles.
// Grimes "free bars"  open and close completely outside of the keltner channel as he defines it 2.25 times ATR (14) 
// around a 20 ema.
// If you use the "Show Adam Grimes free bars in black?" setting you will also get Adam Grimes 
// Keltner channel as per: http://adamhgrimes.com/blog/library/indicators/keltner-statistics/
// If you have Adam Grimes free bars turned on you likely will cover the exhaustion" light blue candles. You will also see 
// aqua coloured dots above or below the candle if you have Leaf West Colored candles turned on and if the free bar is 
// also a Leaf_West "exhaustion"  candle.
// You will also get the Keltners channels and 20 ema since Grimes puts it on most of his charts
// I have not allowed for changing Adam Grimes keltner channels if you must change the parameters go to lines 
// 76 to 79 or ask me to add a provision to make changes

// I could not resist coloring the wicks: green for a bull bar; red for a bear bar (open vs close).
// As a reminder this script follows Leaf_West's calculations as closely as possible.  However sometimes I had to
// guess or use know but possibly outdated parameters.  (eg Does Kevin still use 3.5 times the ATR(14) around a 
// 16 sma for exhaustion candles and is the trigger a close outside the band or ?) If you have a suggestion
// to improve the script let me know.
// Cheers
// Jayy

study("Colored Candles Trend Strength Leaf_West style Jayy", shorttitle="Colored Candles Jayy", overlay=true)
LWadxlength = input(8, title="ADX period")
LWdilength = input(9, title="DMI Length")
lengthkc = input(16, minval=1, title="Length Keltner channel simple average period") 
multkc = input(3.5, minval=0.001, maxval=50, title="Multiplication Factor for ATR in Leaf West KC")
lenatr = input(14, minval=1, title="Length of atr average period")
showKlassen=input(true, title="Show Kevin Klassen's (Leaf_West) colored candles?")
openclose=input(true, title="If Leaf West colors off: open vs close: check or close vs close: uncheck")
showgrimes=input(false, title="Show Adam Grimes free bars in black?")
showgrimeskc=input(true, title="Show Adam Grimes Keltner channels if the free bars displayed?")
showiobars=input(true, title= "Show inside and outside bars?")

dirmov(len) =>
	up = change(high)
	down = -change(low)
	truerange = rma(tr, len)
	plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
	minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
	[plus, minus]

adx(LWdilength, LWadxlength) => 
	[plus, minus] = dirmov(LWdilength)
	sum = plus + minus
	adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), LWadxlength)
	[adx, plus, minus]

[ADX, up, down] = adx(LWdilength, LWadxlength)
LWADX= (ADX-15)*2.5
adxcolor= up>down?green: red


ma = sma(close, lengthkc)
rangeatr =  atr(lenatr) 
upper = ma + rangeatr * multkc
lower = ma - rangeatr * multkc

// Adam Grimes Keltner channel
adamsma = ema(close, 20)
adamsatr =  atr(14) 
upperadams = adamsma + adamsatr * 2.25
loweradams = adamsma - adamsatr * 2.25
plot(showgrimeskc and showgrimes?upperadams:na, title="upper grimes keltner", color =navy)
plot(showgrimeskc and showgrimes?loweradams:na, title="lower grimes keltner", color =navy)
plot(showgrimeskc and showgrimes?adamsma:na, title="20 ema for grimes", color =navy)

coloradx= showgrimes and low>upperadams? black:showgrimes and high<loweradams?black:
    showKlassen ?(close>upper or close<lower? aqua:LWADX>=100?blue:LWADX<=0?yellow: 
    close>close[1] and LWADX>LWADX[1]?lime:close>close[1] and LWADX<LWADX[1]?green:
    close<close[1] and LWADX<LWADX[1]? maroon:close<close[1] and LWADX>LWADX[1]?red:
    open>close?red:close>open?green:na):  showKlassen==false and openclose==true?(close>open?green: open>=close?red:na):
     showKlassen==false and openclose==false?(close>close[1]?green:close[1]>=close?red:na):na
   
    
    
plotcandle(close>open?open:na,close>open?high:na,close>open?low:na,close>open?close:na, title="ADX Color candles - bull bars", color =coloradx, wickcolor=green)
plotcandle(close<open?open:na,close<open?high:na,close<open?low:na,close<open?close:na, title="ADX Color candles - bear bars", color =coloradx, wickcolor=red)
plotcandle(close==open?open:na,close==open?high:na,close==open?low:na,close==open?close:na, title="ADX Color candles - close = open", color =coloradx, wickcolor=silver)


barh=((high[0] < nz(ibh[1]) and low[0] > ibl[1]))?ibh[1]:0 
barl=((high[0] < ibh[1] and low[0] > ibl[1]))?ibl[1]:0 

ibh= (high < high[1] and low > low[1])?high[1]:(high >= ibh[1] or low <= ibl[1])?0:ibh[1]
ibl= (high < high[1] and low > low[1])?low[1]:(high >= ibh[1] or low <= ibl[1])?0:ibl[1]
plotchar(showiobars and (barh>0 and  barl>0) ? close : na, title='Inside bar 2 or more bars back',char='>', location=location.abovebar, color=orange, transp=0, offset=0)

plotchar(showiobars and (high < high[1] and low > low[1]) ? close:na, title='Inside bar',char='>', location=location.abovebar, color=blue, transp=0, offset=0)
plotshape(showiobars and (high < high[1] and low > low[1]) ? close : na, style=shape.triangleup, location=location.belowbar, color=maroon, text=".", offset=0)
plotchar(showiobars and (high > high[1] and low < low[1]) ? close:na, title='Outside bar',char='O', location=location.abovebar, color=black, transp=0, offset=0)
plotshape(showiobars and (high > high[1] and low < low[1]) ? close : na, style=shape.square, location=location.belowbar, color=maroon, text=".", offset=0)

plotshape(LWADX[1]>=100 and LWADX<LWADX[1] and up>=down ? close : na, style=shape.circle, location=location.abovebar, color=fuchsia, text=".", offset=0)
plotshape(LWADX[1]>=100 and LWADX< LWADX[1] and up<=down? close : na, style=shape.circle, location=location.belowbar, color=fuchsia, text=".", offset=0)

plotshape(showKlassen  and showgrimes and low>upperadams and close>upper?close: na, style=shape.circle, location=location.abovebar, color=aqua, text=".", offset=0)
plotshape(showKlassen  and showgrimes and high <loweradams and close<lower? close : na, style=shape.circle, location=location.belowbar, color=aqua, text=".", offset=0)
//simple pivot as per Hawkeye trading
// plotshape(high[1]>high[2] and low[1]>low[2] and high[1]>high[0] and low[1]>low[0] ? close :
//     na, style=shape.triangledown, location=location.abovebar, color=green, text="P", offset=-1)
// plotshape(high[1]<high[2] and low[1]<low[2] and high[1]<high[0] and low[1]<low[0]? close : 
//     na, style=shape.triangleup, location=location.belowbar, color=red, text="P", offset=-1)
////last line
Jayy
Leaf_West PRO
2 months ago
Doesn't look quite as good as mine :)
Reply
jayy PRO Leaf_West
2 months ago
Hey Leaf_West thanks for looking in. Replicas are rarely as good as the original. I will add a link to your current Blog (http://charts-by-leaf.com/) to my Leaf_West style scripts. Cheers jayy
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener 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 Billing Sign Out