DataSeries NRTR_WATR( Bars bars, int lookback, double multiple );
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using Community.Indicators;namespace WealthLab.Strategies { public class Demo : WealthScript { private StrategyParameter paramLookback; private StrategyParameter paramMultiple; public Demo() { paramLookback = CreateParameter("Lookback", 20, 5, 50, 1); paramMultiple = CreateParameter("Multiple", 3, 1, 5, 1); } protected override void Execute() { int Lookback = paramLookback.ValueInt; double Mult = paramMultiple.Value; NRTR_WATR nrtr = NRTR_WATR.Series( Bars, Lookback, Mult ); // Display the resulting NRTR_WATR data series PlotSeries( PricePane, nrtr, Color.Teal, LineStyle.Dotted, 2 ); // A simple strategy for(int bar = nrtr.FirstValidValue+1; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( CrossUnder( bar, Close, nrtr ) ) SellAtMarket( bar+1, LastPosition, "NRTR Exit" ); } else { if( CrossOver( bar, Close, nrtr ) ) BuyAtMarket( bar+1, "NRTR Entry" ); } } } } }