public LinearRegSlope(DataSeries ds, int period, string description) public static LinearRegSlope 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() { /* Minor up and down trends highlighted by confirmation of 2 linear regression lines */ DataSeries lrs20 = LinearRegSlope.Series( Close, 20 ); DataSeries lrs10 = LinearRegSlope.Series( Close, 10 ); ChartPane LinRegSlopePane = CreatePane( 50, true, true ); PlotSeries( LinRegSlopePane, lrs20, Color.Black, WealthLab.LineStyle.Solid, 1 ); PlotSeries( LinRegSlopePane, lrs10, Color.Blue, WealthLab.LineStyle.Solid, 1 ); SetBarColors( Color.Black, Color.Black ); for(int bar = 20; bar < Bars.Count; bar++) { if( ( lrs20bar > 0 ) & ( lrs10bar > 0 ) ) SetBarColor( bar, Color.Blue ); if( ( lrs20bar < 0 ) & ( lrs10bar < 0 ) ) SetBarColor( bar, Color.Red ); } } } }