public ATRBandUpper(Bars bars, DataSeries ds, int atrPeriod, double atrMult, string description) public static ATRBandUpper(Bars bars, DataSeries ds, int atrPeriod, double atrMult)
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 MyStrategy : WealthScript { protected override void Execute() { HideVolume(); LinearReg lr = LinearReg.Series( Close,10 ); ATRBandUpper ub = new ATRBandUpper( Bars, lr, 10, 2, "My Upper ATR Band" ); ATRBandLower lb = new ATRBandLower( Bars, lr, 10, 2, "My Lower ATR Band" ); PlotSeriesFillBand( PricePane, ub, lb, Color.Transparent, Color.FromArgb( 30, Color.Blue ), LineStyle.Solid, 1 ); for(int bar = ub.FirstValidValue; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if ( bar+1 - p.EntryBar >= 10 ) ExitAtMarket( bar+1, p, "Timed" ); } else { if( ( CumUp.Series( High,1 )[bar] >= 2 ) && ( High[bar] > ub[bar] )) ShortAtMarket( bar + 1 ); else if( ( CumDown.Series( Low,1 )[bar] >= 2 ) && ( Low[bar] < lb[bar] )) BuyAtMarket( bar + 1 ); } } } } }