jayy

VWAP forex Yesterday Hi/Low switch

This script plots VWAP, yesterday's high, low, open and close (HLOC), the day before's HLOC -
Also plots higher timeframe 20 emas including:
1 minute 5, 15, 60 period 20 ema
5 minute 15, 60 period 20 ema
15 minute 60, 120 , 240 period 20 ema
60 minute 120, 240 period 20 ema
120 minute 240, D period 20 ema
240 minute D period 20 ema
Also signals inside bars (high is less than or equal to the previous
bar's high and the low is greater than or equal to the previous low) the : true inside bars have a maroon triangle below the bar as well as a ">" above the bar.
If subsequent bars are inside the last bar before the last true inside bar they also are marked with an ">"
If you have suggestions let me know.
Jayy

Jayy
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?
//  
// plots VWAP, yesterday's high, low, open and close (HLOC),
// the day before's HLOC -
// Also plots higher timeframe  20 emas
// 1 minute 5, 15, 60 period 20 ema
// 5 minute  15, 60 period 20 ema
// 15 minute 60, 120 , 240 period 20 ema
// 60 minute 120, 240 period 20 ema
// 120 minute 240, D period 20 ema
// 240 minute D period 20 ema
// Also signals inside bars (high is less than or equal to the previous 
// bar's high and the low is greater than or equal to 
// the previous low) the : true inside bars have a maroon triangle below the bar as well as a ">" above the bar. 
// If subsequest bars are inside the last bar before the last true inside bar they also are marked with an ">" 
// This is probably a slight variation from the way Leaf_West plots the inside bars. 
// It appears that he marks all bars that are inside the original bar until one a bar has a high or low 
// outside the original bar. But I would need to see an example on his charts. 
// If it needs work let me know.
// Jayy

study(title="VWAP forex Yesterday Hi/Low switch", shorttitle="VWAP forex Hi/Low Jayy", overlay = true)


Highhier  = security(tickerid,"D", high[1])
Lowhier   = security(tickerid,"D", low[1])
Closehier = security(tickerid,"D", close[1])
Openhier = security(tickerid,"D", open[1])
Opentoday = security(tickerid,"D", open[0])
shovwap = input(true, title= "Show VWAP?") 
shohloc2 = input(false, title= "Show HLOC from 2 days ago?") 
Highhier2  = security(tickerid,"D", high[2])
Lowhier2   = security(tickerid,"D", low[2])
Closehier2 = security(tickerid,"D", close[2])
Openhier2 = security(tickerid,"D", open[2])
shoactEMA=input(false, title= "Show actual 20 EMA for current period?")
shoEMA=input(false, title= "Show higher timeframe 20 EMAs?")
shoinsid = input(false, title= "Show inside and outside bars?") 
width = input(2, minval=1)
close5 = security(tickerid,"5", close[0]) 
close15 = security(tickerid,"15", close[0]) 
close60 = security(tickerid,"60", close[0]) 
close120 = security(tickerid,"120", close[0]) 
close240 = security(tickerid,"240", close[0]) 
closeD = security(tickerid,"D", close[0]) 
EMA5 =  security(tickerid,"5", ema(close5,20)) 
EMA15 =  security(tickerid,"15", ema(close15,20)) 
EMA60 =  security(tickerid,"60", ema(close60,20)) 
EMA120 =  security(tickerid,"120", ema(close120,20)) 
EMA240 =  security(tickerid,"240", ema(close240,20)) 
EMAD =  security(tickerid,"D", ema(closeD,20))
ri= input("1700-1700", type=session, title= "plot session")
z="1701-1700"
plot(shoEMA and period=="1"?EMA5:na, color = navy, style=line, linewidth = 2, title="5 minute period 20ema")
plot(shoEMA and (period=="1" or period=="5")?EMA15:na, color = maroon, style=line, linewidth = 2,title="15 minute period 20ema" )
plot(shoEMA and (period=="1" or period=="5" or period=="15")?EMA60:na, color = aqua, style=line, linewidth = 2,title="60 minute period 20ema" )
plot(shoEMA and (period=="15" or period=="60" )?EMA120:na, color = fuchsia, style=line, linewidth = 2,title="120 minute period 20ema" )
plot(shoEMA and ( period=="15" or period=="60" or period=="120"  )?EMA240:na, color = maroon, style=line, linewidth = 2, title="240 minute  period 20ema")
plot(shoEMA and (period=="120" or period=="240")?EMAD:na, color = navy, style=line, linewidth = 2, title="1 day period 20ema")
plot(shoactEMA ?ema(close,20):na, color = lime, style=line, linewidth = 2, title="Current period 20ema")
plot(shoactEMA ?ema(close,20):na, color = red, style=circles, linewidth = 1)
plot(shoEMA and (period=="1" or period=="5" or period=="15" or period=="60" )?EMA120:na, color = black, style=circles, linewidth = 1)
//plot(shovwap and isintraday?vwap:na,color=a,style=line, linewidth=2)

r= input("1700-1700", type=session, title= "plot session")

plot(shovwap and isintraday?vwap:na,color=time ("1", z)?fuchsia:na,style=line, linewidth=2,title="VWAP") //color=time ("1", z)?fuchsia:na
//ri=sess?r:"800-1700"
// Plot high and low and close  from yesterday 
//b=time ("1", z)?lime:na
plot(isintraday?Highhier:na,  title='yesterdays high', color=time ("1", z)?lime:na,style=linebr, linewidth=2, editable=true)
//c=time ("1", z)?orange:na
plot(isintraday?Lowhier:na,color=time ("1", z)?orange:na,style=line, linewidth=2, title="yesterdays low")
//d=time ("1", z)?red:na
plot(isintraday?Closehier:na,color=time ("1", z)?red:na,style=line, linewidth=2, title="yesterdays close")
//Plot open from today
//e=time ("1", z)?yellow:na
plot(isintraday?Openhier:na,color=time ("1", z)?yellow:na, style=line, linewidth=2, title="yesterdays open") 
//plot(isintraday?Opentoday:na,color=time ("1", z)?fuchsia:na, style=line, linewidth=2, title="yesterdays open") 
b=time ("1", z)?black:na
plot(isintraday?Highhier:na,color=b,style=cross, linewidth=1) //, title="yesterday's high"
//c=time ("1", z)?orange:na
plot(isintraday?Lowhier:na,color=b,style=cross, linewidth=1)  // , title="yesterday's low"
//d=time ("1", z)?red:na
plot(isintraday?Closehier:na,color=b,style=cross, linewidth=1)//, title="yesterday's close"
//e=time ("1", z)?yellow:na
plot(isintraday?Openhier:na,color=b, style=cross, linewidth=1) //, title="yesterday's open"
plot(shohloc2 and isintraday?Highhier2:na,color=lime,style=cross, linewidth=1)

plot(shohloc2 and isintraday?Lowhier2:na,color=orange,style=cross, linewidth=1)

plot(shohloc2 and isintraday?Closehier2:na,color=red,style=cross, linewidth=1)

plot(shohloc2 and isintraday?Openhier2:na,color=yellow, style=cross, linewidth=1) 
//plot  inside bar
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((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((high < high[1] and low > low[1]) ? close:na, title='Inside bar',char='>', location=location.abovebar, color=teal, transp=0, offset=0)
plotshape((high < high[1] and low > low[1]) ? close : na, style=shape.triangleup, location=location.belowbar, color=maroon, text=".", offset=0)
plotchar((high > high[1] and low < low[1]) ? close:na, title='Outside bar',char='O', location=location.abovebar, color=black, transp=0, offset=0)
plotshape((high > high[1] and low < low[1]) ? close : na, style=shape.square, location=location.belowbar, color=maroon, text=".", offset=0)
//plottshape()

//// last line