DataSeries CrossOverValueBar( DataSeries ds, double value );
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 XOVBStrategy : WealthScript { protected override void Execute() { CCI cci = CCI.Series( Bars, 14 ); int val = -100; CrossOverValueBar xob = CrossOverValueBar.Series( cci, val ); SetBarColors( Color.Silver, Color.Silver ); for (int bar = xob.FirstValidValue; bar < Bars.Count; bar++) { if( xob[bar] == bar ) SetBarColor( bar, Color.Red ); if (IsLastPositionActive) { CoverAtStop( bar+1, LastPosition, Highest.Series( High, 20 )[bar] ); } else { if( ( cci[bar] > -val ) & ( xob[bar] > bar - 3 ) ) ShortAtMarket( bar+1 ); } } ChartPane xPane = CreatePane( 20, true, true ); ChartPane cciPane = CreatePane( 20, true, true ); PlotSeries( xPane, xob, Color.Red, WealthLab.LineStyle.Dashed, 2 ); PlotSeries( cciPane, cci, Color.Blue, WealthLab.LineStyle.Solid, 1 ); DrawHorzLine( cciPane, val, Color.Black, WealthLab.LineStyle.Dashed, 1 ); } } }