DataSeries CrossUnderBar( DataSeries ds1, DataSeries ds2 );
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 XUBStrategy : WealthScript { protected override void Execute() { BBandUpper bbU = BBandUpper.Series( Close, 20, 2 ); CrossUnderBar xub = CrossUnderBar.Series( Close, bbU ); SetBarColors( Color.Silver, Color.Silver ); for (int bar = xub.FirstValidValue; bar < Bars.Count; bar++) { if( xubbar == bar ) SetBarColor( bar, Color.Blue ); if (IsLastPositionActive) { SellAtStop( bar+1, LastPosition, Lowest.Series( Low, 20 )bar ); } else { if( ( Closebar < bbUbar ) & ( xubbar > bar - 3 ) ) BuyAtMarket( bar+1 ); } } ChartPane xPane = CreatePane( 20, true, true ); PlotSeries( xPane, xub, Color.Blue, WealthLab.LineStyle.Dashed, 2 ); PlotSeries( PricePane, bbU, Color.Blue, WealthLab.LineStyle.Solid, 1 ); } } }