public ATRP(WealthLab.Bars bars, int period, string description) public static ATRP Series(WealthLab.Bars bars, int period)
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;namespace WealthLab.Strategies { public class MyStrategy : WealthScript { /* Short when price hits the High of the previous bar * (1 + ATRP/100 ) Cover on trailing stop of the same series */ protected override void Execute() { // Convert to fractional percentage, e.g., 3.5% -> 0.035 DataSeries hATRP = ATRP.Series( Bars, 5 ) / 100 + 1; DataSeries hATRP_H = Bars.High * hATRP; // Delay indicator plot by 1 bar to observe crossovers PlotSeries( PricePane, hATRP_H>>1, Color.Blue, LineStyle.Dotted, 2 ); DrawLabel( PricePane, "ATRP_H + 2%" ); PlotStops(); for(int bar = 15; bar < Bars.Count; bar++) { if (IsLastPositionActive) CoverAtTrailingStop( bar+1, LastPosition, hATRP_H[bar] ); else ShortAtLimit( bar+1, hATRP_H[bar] ); } } } }