Hey,
I am looking to do an intraday Std calculation, which resets at the end of the trading day.
Pretty much like the VWAP indicator is operating, but then applying standard deviation rather than volume * price.
I think I can figure it out if I could open the source code of the VWAP calc, and create a custom indicator, but being relatively new I unfortunately don't know where to find it.
Any help is appreciated!
Kind regards,
Koen
I am looking to do an intraday Std calculation, which resets at the end of the trading day.
Pretty much like the VWAP indicator is operating, but then applying standard deviation rather than volume * price.
I think I can figure it out if I could open the source code of the VWAP calc, and create a custom indicator, but being relatively new I unfortunately don't know where to find it.
Any help is appreciated!
Kind regards,
Koen
Rename
Hmmm, not sure if this is exactly what you're looking for but we do have this paid Concierge extension CAVWAP, check the screen shots.
https://www.wealth-lab.com/extension/detail/CAVWAP
https://www.wealth-lab.com/extension/detail/CAVWAP
Check out https://www.wealth-lab.com/Discussion/Anchored-VWAP-indicator-10356 for a calculation.
By the way, we don't typically use standard deviation in technical analysis because it's too sensitive to outliers. We use ATR instead.
I always thought about writing a "robust" standard deviation indicator that would reject outliers, but haven't got around to it.
By the way, we don't typically use standard deviation in technical analysis because it's too sensitive to outliers. We use ATR instead.
I always thought about writing a "robust" standard deviation indicator that would reject outliers, but haven't got around to it.
Thanks superticker, i'll have a look at that!
Yeah whether i'd be using ATR or StdDev (or some other volatility calc), the issue is the same that it needs to be reset daily from the opening bar and that the range is dynamically increasing during the day.
@Glitch, thanks for the tip, but i'm looking for an intraday measure of pricevolatility, not of VWAP-vol.
Yeah whether i'd be using ATR or StdDev (or some other volatility calc), the issue is the same that it needs to be reset daily from the opening bar and that the range is dynamically increasing during the day.
@Glitch, thanks for the tip, but i'm looking for an intraday measure of pricevolatility, not of VWAP-vol.
Is the idea to recalculate a "expanding StdDev" recalculating every bar from the start of the day? If so, then you'd do that like this:
You need at least 3 bars to calculate StdDev, so if you're using this TimeSeries, check to make sure it's not a Double.NaN.
CODE:
using System; using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; using System.Collections.Generic; using Humanizer; namespace WealthScript2 { public class MyStrategy : UserStrategyBase { TimeSeries _rSD; public override void Initialize(BarHistory bars) { if (!bars.IsIntraday) { DrawHeaderText("Intraday Bars Required", WLColor.Fuchsia, 14); return; } _rSD = new TimeSeries(bars.DateTimes, true); int firstBar = 0; for (int bar = 1; bar < bars.Count; bar++) { if (bars.IsFirstBarOfDay(bar)) { firstBar = bar; continue; } int n = bar - firstBar; if (n > 1) { _rSD[bar] = StdDev.Value(bar, bars.Close, n); } } PlotTimeSeries(_rSD, "Resetting SD", "rSD"); } public override void Execute(BarHistory bars, int idx) { } } }
You need at least 3 bars to calculate StdDev, so if you're using this TimeSeries, check to make sure it's not a Double.NaN.
Your Response
Post
Edit Post
Login is required