Daily Distribution Lines (standard deviation)
CompletedAutomatically plot lines for 68% and 95% based off of VWAP for the current day's trading session
-
Aloha there Accendo - I just shared an enhanced version of Tradovate's VWAP indicator called "Tiki VWAP".
It doesn't have 68% or 95% bands plotted, but it does plot bands using a formula I have seen to calculate 1st and 2nd std deviations. If you have a formula I could look at to double-check my work that would be great!
Hope this helps, it definitely helps me spot opportunities such as in the chart attached.

-
The formula used to calculate the rolling standard deviation is incorrect. The correct formula is located here in this code. There is a comment in the source code with a link on all manner of rolling standard deviation and moving average calculations, many goodies.
https://www.tradingview.com/script/dQF211AS-Multi-Timeframe-VWAP/
-
Look for this section of the source code:
getVWAP(newSession) =>
p = iff(newSession, hlc3 * volume, p[1] + hlc3 * volume)
vol = iff(newSession, volume, vol[1] + volume)
v = p / vol
// Incremental weighted standard deviation (rolling)
// http://people.ds.cam.ac.uk/fanf2/hermes/doc/antiforgery/stats.pdf (part 5)
// x[i] = hlc3[i], w[i] = volume[i], u[i] - v[i]
Sn = iff(newSession, 0, Sn[1] + volume * (hlc3 - v[1]) * (hlc3 - v))
std = sqrt(Sn / vol)
[v, std]The link and section of that article show just how the standard deviation is calculated from point to point, or in our case, candle to candle. You would need to adjust maybe less than 3 lines of code for the final STD calculation in both places where a d.profile() (volume profile exists) or when it doesn't exist.
Please sign in to leave a comment.
Comments
7 comments