trading.kay27

Kay_High_Low

Previous High low plotting.
COPIED from Chris Moody's script and adjusted it for my needs.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//Created by ChrisMoody 7-21-2014
//Daily, Weekly, Monthly, Quarterly, Yearly Projected Highs and Lows 
//Obtained formula from Larry Williams, original formula from Owen Taylor
//Modified by trading.kay for lower time frames
study(title="Kay_High_Low", shorttitle="Kay_H_L", overlay=true) 

s5m = input(false, title="5Min HL?")
s15m = input(true, title="15Min HL?")
sh = input(true, title="Hourly HL?")
s4h = input(false, title="4H HL?")
sd = input(false, title="Daily HL?")
sw = input(false, title="Weekly HL?")
sm = input(false, title="Monthly HL?")

//getData(res) =>
//	pf = (hlc3) * 2
//	pl = pf - high
//	ph = pf - low
//	f = security(tickerid, res, pf[1])
//	h = security(tickerid, res, ph[1])
//	l = security(tickerid, res, pl[1])
//	[f, h, l]

getData(res) =>
    h = security(tickerid, res, high[1])
	l = security(tickerid, res, low[1])
	[h,l]

//-------------------5 Min
[h5, l5] = getData("5")
cl5 = close > l5 or close < h5 ? blue : red

plot(s5m ? l5 : na, title="5M Proj Low",style=circles, color=cl5 ,linewidth=3) 
plot(s5m ? h5 : na, title="5M Proj High",style=circles, color=cl5 ,linewidth=3) 

//-------------------15 mins
[h15, l15] = getData("15")
cl15 = close > l15 or close < h15 ? orange : red

plot(s15m ? l15 : na, title="15M Proj Low",style=circles, color=cl15 ,linewidth=2, transp=0) 
plot(s15m ? h15 : na, title="15M Proj High",style=circles, color=cl15 ,linewidth=2, transp=0) 

//-------------------Hourly
[hh, lh] = getData("60")
clh = close > lh or close < hh ? blue : red

plot(sh ? lh : na, title="H Proj Low",style=circles, color=clh ,linewidth=2, transp=0) 
plot(sh ? hh : na, title="H Proj High",style=circles, color=clh ,linewidth=2, transp=0) 

//--------------------4Hr
[h4h, l4h] = getData("240")
cl4h = close > l4h or close < h4h ? green : red

plot(s4h ? l4h : na, title="4H Proj Low",style=circles, color=cl4h ,linewidth=1) 
plot(s4h ? h4h : na, title="4H Proj High",style=circles, color=cl4h ,linewidth=1) 

//--------------------Daily
[hd, ld] = getData("D")
cld = close > ld or close < hd ? blue : red

plot(sd ? ld : na, title="D Proj Low",style=circles, color=cld ,linewidth=3) 
plot(sd ? hd : na, title="D Proj High",style=circles, color=cld ,linewidth=3)