public KeltnerLower(Bars bars, int periodOne, int periodTwo, string description) public static KeltnerLower Series(Bars bars, int periodOne, int periodTwo)
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() { DataSeries K1 = KeltnerLower.Series( Bars, 10, 10 ); DataSeries K2 = KeltnerUpper.Series( Bars, 10, 10 ); PlotSeriesFillBand( PricePane, K1, K2, Color.Blue, Color.Empty, LineStyle.Solid, 2); for(int bar = 30; bar < Bars.Count; bar++) { if( !IsLastPositionActive ) { if( CrossOver( bar, Close, K2 ) ) BuyAtMarket( bar+1 ); else if( CrossUnder( bar, Close, K1 ) ) ShortAtMarket( bar+1 ); } else { Position p = LastPosition; if( CrossOver( bar, Close, K2 ) & p.PositionType != PositionType.Long ) { CoverAtMarket( bar+1, p ); BuyAtMarket( bar+1 ); } if( CrossUnder( bar, Close, K1 ) & p.PositionType == PositionType.Long ) { SellAtMarket( bar+1, p ); ShortAtMarket( bar+1 ); } } } } } }