DataSeries ConsecDaysDown( DataSeries ds, double pct ); DataSeries ConsecDaysUp( DataSeries ds, double pct );
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Indicators;namespace WealthLab.Strategies { public class ConsecDaysDemo : WealthScript { protected override void Execute() { ConsecDaysDown cdd = ConsecDaysDown.Series( Close, 5 ); ConsecDaysUp cdu = ConsecDaysUp.Series( Close, 5 ); ChartPane mPane = CreatePane( 20, true, true ); PlotSeries( mPane, cdd, Color.Red, LineStyle.Histogram, 10 ); PlotSeries( mPane, cdu, Color.Blue, LineStyle.Histogram, 10 ); for(int bar = 1; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if ( bar+1 - p.EntryBar >= 5 ) ExitAtMarket( bar+1, p, "Timed" ); } else { if( cdubar >= 2 ) ShortAtMarket( bar+1 ); if( cddbar >= 2 ) BuyAtMarket( bar+1 ); } } } } }