public LinearReg(DataSeries ds, int period, string description) public static LinearReg Series(DataSeries ds, int period) public static double Value(int bar, DataSeries ds, int period)
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() { // Report on how far closing prices are away from predicted value string s; int bar = Bars.Count-1; double close = Closebar; double Diff = close - LinearReg.Series( Close, 20 )bar; Diff = Diff/close*100; if( Diff > 0 ) s = "Price closed above "; else s = "Price closed below "; Diff = Math.Abs( Diff ); s = s + "the Regression Line by " + Bars.FormatValue( Diff ) + "%"; DrawLabel( PricePane, s ); PlotSeries( PricePane, LinearReg.Series( Close, 20 ), Color.Black, WealthLab.LineStyle.Solid, 1 ); } } }