public static StdDev Series(DataSeries ds, int period, WealthLab.Indicators.StdDevCalculation calcType) public StdDev(DataSeries ds, int period, StdDevCalculation calcType, string description) public static double Value(int bar, DataSeries ds, int period, StdDevCalculation calcType)
if( StdDev.Value( bar, Close, 20 ) < 1.5 ...
/* Normalized */ double C = Closebar; if( ( StdDev.Series( Close, 20 )bar / C ) < ( 1.5 / C ) )...
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // Divide Standard Deviation by Average Price to arrive at a normalized Volatility indicator DataSeries MyVolatility = StdDev.Series( Close, 30, StdDevCalculation.Population ) / SMA.Series( Close, 30 ); MyVolatility.Description = "Normalized Volatility"; ChartPane VolPane = CreatePane( 50, true, true ); PlotSeries( VolPane, MyVolatility, Color.Purple, LineStyle.Histogram, 3 ); // Plot Std Dev Bands aka Bollinger Bands HideVolume(); DataSeries StdDevBand = StdDev.Series( Close, 20, StdDevCalculation.Population ) * 2; DataSeries StdH = SMA.Series( Close, 20 ) + StdDevBand; DataSeries StdL = SMA.Series( Close, 20 ) - StdDevBand; PlotSeriesDualFillBand( PricePane, StdH, StdL, Color.FromArgb(10,10,0,0), Color.Empty, Color.Empty, LineStyle.Solid, 1 ); } } }