public TrendLinePeaks(DataSeries ds, double reversepct, bool uselogscale, string description) public static TrendLinePeaks Series(DataSeries ds, double reversepct, bool uselogscale)
/* Catch breakouts over a descending trendline */using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using TASCIndicators;namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { bool useLog = true; DataSeries tP = TrendLinePeaks.Series(High, 10, useLog); PlotSeries(PricePane, tP, Color.Red, LineStyle.Dashed, 1); PlotStops(); for (int bar = tP.FirstValidValue; bar < Bars.Count; bar++) { if( IsLastPositionActive ) { Position p = LastPosition; if( Closebar < p.EntryPrice * 0.95 ) SellAtMarket(bar + 1, p, "Stop Loss"); else // Keep 80% of the profit after achieving a 25% target SellAtAutoTrailingStop(bar + 1, p, 25.0, 20.0); } else { if( tPbar < tPbar-1 ) // descending trendline if( CrossOver(bar, Close, tP) ) BuyAtMarket( bar + 1 ); } } } } }