study("VWAP%Env") factor = input(.0010), atrlong = atr(55), atrshort = atr(7), ratio = atrlong/atrshort,env = vwap*factor*ratio, upperband = vwap+env, lowerband = vwap-env, midband = upperband-((upperband - lowerband)/2) plot(upperband,color=blue) plot(lowerband,color=yellow) plot(midband, color=green)
This is interesting. I'm trying to understand the thinking behind the ATR ratio though. Say the short term ATR grows large due to recent volatility, and the long term ATR is small, now the ratio will be a decimal and you are multiplying the VWAP by that, which will have the effect of creating the inverse of volatility.
The idea is to put a volatility-related band around the VWAP which I prefer generally to all MA's etc. I can't really code in this language to it's very simple and quite possibly the two values I have chosen aren't the best. I have noticed that nearly all days except strong trend days that the market will tend to go somewhere by about 11 am EST and then come back to the VWAP, making a fairly regular day-trade setup. I wanted these bands to put in a reasonable entry point level (the outer band). I also wrote a points-based one to easily see if the bands are wide or narrow relative to that fixed value. If it's a very narrow rangebound day then one can sell the top band and buy the bottom since price will tend to oscillate around the VWAP. I wish I could code better in this lingo but I find it helpful. I also use crosses instead of lines so it doesn't draw weird jumps between each market day/session. I don't think I can send a picture in this medium since I can't see how to make the url and can't publish ideas any more....