public KeltnerATR_Upper(Bars bars, int smaPeriod, int atrPeriod, double atrMult, string description) public static KeltnerATR_Upper(Bars bars, int smaPeriod, int atrPeriod, double atrMult)
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using Community.Indicators;namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { Color cool = Color.FromArgb( 50, Color.Blue ); KeltnerATR_Lower K1 = KeltnerATR_Lower.Series( Bars, 10, 10, 2 ); KeltnerATR_Upper K2 = KeltnerATR_Upper.Series( Bars, 10, 10, 2 ); PlotSeriesFillBand( PricePane, K1, K2, cool, cool, 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 ); } } } } } }