DataSeries Squeeze( Bars bars, DataSeries ds, int period, double dev )
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 SqueezeStrategy : WealthScript { protected override void Execute() { PlotSeriesDualFillBand( PricePane, BBandUpper.Series( Close, 20, 2 ), BBandLower.Series( Close, 20, 2 ), Color.Transparent, Color.Blue, Color.Blue, LineStyle.Solid, 2 ); PlotSeriesDualFillBand( PricePane, KeltnerUpper.Series( Bars, 20, 20 ), KeltnerLower.Series( Bars, 20, 20 ), Color.Transparent, Color.Black, Color.Black, LineStyle.Solid, 3 ); Squeeze squeeze = Squeeze.Series( Bars, Close, 20, 2 ); ChartPane SqueezePane = CreatePane( 30, true, true ); PlotSeries( SqueezePane, squeeze, Color.Blue, LineStyle.Histogram, 3 ); for(int bar = 20; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( CumDown.Series( Momentum.Series( Close, 14 ), 1 )[bar] >= 1 ) SellAtMarket( bar+1, LastPosition, "MomExit" ); } else { if( squeeze[bar] < 0.00 ) BuyAtMarket( bar+1 ); } } } } }