TradingView
rumpypumpydumpy
Sep 4, 2019 5:42 PM

Anchored VWAP & Standard Deviations 

Bitcoin / U.S. dollarBitstamp

Description

Calculates VWAP from a fixed point in time as well as standard deviations.

--------------------------------------

If you find it useful please consider a tip/donation :

BTC - 3BMEXEDyWJ58eXUEALYPadbn1wwWKmf6sA


--------------------------------------

Release Notes

  • Added options for multiple standard deviations and intervals (default is every 0.5 up to 4 σ)
  • Used some of the new pine 4 features to help with clarity (multiples make a bit of a spaghetti chart) and quickly setting up multiple AVWAPs. Labeling and bulk color changes etc.
Comments
dchahar3
this is awesome
but can you guide how we use for a better result
lanatmwan
Is there anything in the UI that lets you change the anchor point?
rumpypumpydumpy
@lanatmwan, that's what the datetime settings are for. It determines the anchor point, ie when to begin the vwap
Albatros_Malkoc_68
I added it to the indicators but I couldn't activate it on my charts.
Have you restricted access?
Trix79
@lanatmwan thanks so much for this script. Im just a little confused on the DATE settings ie. lookback to start on for YEAR, MONTH, DAY & or HOUR? and for what TIMEFRAMES to use these settings for the Crypto markets? TIA
Utraderz
Many thanks for the great script!

For a crazy/pure evil/extraterrestrial reason, the negative deviation lines are not parallel with the vwap line in price spikes. The deviation is more pronounced the further we are from the vwap. Eg

sd8_pos = avwap + (dev * mult8) sd8_neg = avwap - (dev * mult8)


sd8_pos - sd8_neg should be constant. It's not!!!

rumpypumpydumpy
@Utraderz, There's a few reasons we see this type of behaviour. Primarily it's from viewing the chart in logarithmic scaling. If you disable the chart setting it will display consistently as you would expect. The reason we get such unusual negative values at higher multiples of standard deviations is due to the fact we calculate the standard deviation normally as dispersion around the actual mean, however we are using the standard deviation value by adding/subtracting from the VWAP instead of the mean. This is more likely to result in negative stdev bands, especially on instruments such as crypto where the dispersion can be extreme due to bull run price values with wide dispersion disproportionally above the vwap rather than being spread relatively symmetrically above AND below the mean as would happen in the standard method of calculating mean/stdev.
Utraderz
@rumpypumpydumpy, log scaling it is!!!
andrew2669
I am relatively new to pine script. I have tried several things but cannot get the indicator (study) to always anchor to the beginning of the chart. Any ideas?
cheetahcapital1
I only use vwap and 1std standard deviation. These are not showing the same values as the one I have on Ninja Trader and I believe Ninja is correct the way price is respecting those. I am using a 12 month anchor period. Any suggestions on how to fix this? Thank You
More