jayy

VWAP with FIB range Jayy

This is sandbox experiment. The script creates bands around the VWAP based on the opening range on an intraday chart (adjustable in the format section) using fibonacci multipliers (mostly): .236, .382, .5, .618, .786, 1, 1.27 and 1.618. I have not built much flexibility into the script so this is very much an alpha script. Something new for Pippin and Kipp.

Jayy
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
study("VWAP with FIB range Jayy", overlay=true)

res = input('15', type=resolution, title=" length/time Of Opening Range?")
factor = input(1, title= " Factor to multiple range by if wanted"),//range = input (.14),//env = range*factor,

bartimeSess =  time('D') 
fr2to17 =  time(period) 
newbarSess = bartimeSess != bartimeSess[1]
high_range = valuewhen(newbarSess,high,0)
low_range = valuewhen(newbarSess,low,0)
adopt(r, s) => security(tickerid, r, s)

//Formula For Opening Range
highRes = adopt(res, high_range)
lowRes = adopt(res, low_range)
range = highRes - lowRes

//fibs should be .23, .38,.5,  .618, .78,  1, 1.27, 1.618, 2.618, 4.23, 6.85
env = range*factor
upperband = vwap+(env*.236), lowerband = vwap-(env*.236)
upperband2 = vwap +(env*.382), lowerband2 = vwap-(env*.382)
upperband3 = vwap +(env*.5), lowerband3 = vwap-(env*.5)
upperband4 = vwap +(env*.618), lowerband4 = vwap-(env*.618)
upperband5 = vwap +(env*.786), lowerband5 = vwap-(env*.786)
upperband6 = vwap +(env*1.), lowerband6 = vwap-(env*1.)
upperband7 = vwap +(env*1.27), lowerband7 = vwap-(env*1.27)
upperband8 = vwap +(env* 1.618), lowerband8 = vwap-(env*1.618)
// plot only during session to elimate the mess 
//between 4 pm close and 8:30 open on open session charts

green1 =time (period, "930-931")?na:green// black
red1 =time (period,  "930-931")?na:red//black
black1 =time (period,  "930-931")?na:black//black
green2 =time (period,  "930-931")?na:lime//black
red2 =time (period,  "930-931")?na:orange//black
plot(upperband8,style=line,linewidth=2,color=green2,transp=90)
plot(lowerband8,style=line,linewidth=2,color=red2,transp=90)
plot(upperband7,style=line,linewidth=2,color=green2,transp=90)
plot(lowerband7,style=line,linewidth=2,color=red2,transp=90)
plot(upperband6,style=line,linewidth=2,color=green2,transp=90)
plot(lowerband6,style=line,linewidth=2,color=red2,transp=90)
plot(upperband5,style=line,linewidth=2,color=green1,transp=90)
plot(lowerband5,style=line,linewidth=2,color=red1,transp=90)
plot(upperband4,style=line,linewidth=2,color=green2,transp=90)
plot(lowerband4,style=line,linewidth=2,color=red2,transp=90)
plot(upperband3,style=line,linewidth=2,color=green1,transp=90)
plot(lowerband3,style=line,linewidth=2,color=red1,transp=90)
plot(upperband2,style=line,linewidth=2,color=green1,transp=90)
plot(lowerband2,style=line,linewidth=2,color=red1,transp=90)
plot(upperband,style=line,linewidth=2,color=green1,transp=90)
plot(lowerband,style=line,linewidth=2,color=red1,transp=90)
plot(vwap,style=line,linewidth=2,color=black1,transp=90)

// The idea is to first find the Daily 7-bar ATR (or any other nr. of days desired) 
// and then input that into the range, i.e. of the 7-Day ATR is 2.5, input 2.5). The factor input 
// determines the width of the bars relative to the ATR and since there are six bands, one sixth 
// of the Daily ATR would be .1666, so I changed that to .1618 to have a nice Fibonacci number. 
// In any case, the result is that the range of the bands from the outermost on top to the outermost
// on the bottom should roughly correlate with the Daily ATR. Ideally these bands could
// be rounded to ticks so that they will print out precise price levels for trading but
// I am not able to program that in in this language. 
// For use of vwap, use google etc. I prefer it to moving averages since it is a precise statistical 
// calculation using volume, and also it remains the same in all time frames, albeit mainly
// used for intraday charts.
// I also like to use the bands for entries, stops and profit targets - along with basic 
// price information from the bars.
// I wrote essentially the same indicator called VBandPts wherein the input for the bandwidth
// is a simple point value number so that you can get the bands to display in ticks or points,
// i.e. 3 points, 2.5 pts etc. So in that case you can take the current indicator to see
// roughly what the bandwith is, and then use the VwapPts on the chart to get bands 
// close in value to the raw calcs from this one, but more helpful for trading.
// Either way, it's just a simple visual grid overlaid on top of the basic vwap value.