public static PeakBar Series(DataSeries source, double reversalAmount, PeakTroughMode mode) public static double Value(int bar, DataSeries source, double reversalAmount, PeakTroughMode mode)
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { //Draw a trendline from the 2 most recent 10% Peaks bool Detected2Peaks = false; int bar = Bars.Count-1; int p2 = -1; int p1 = (int)PeakBar.Value( bar, Close, 10, PeakTroughMode.Percent ); if( p1 > -1 ) { p2 = (int)PeakBar.Value( p1, Close, 10, PeakTroughMode.Percent ); if( p2 > -1 ) { DrawLine( PricePane, p1, Close[p1], p2, Close[p2], Color.Red, WealthLab.LineStyle.Solid, 1 ); Detected2Peaks = true; } } if( !Detected2Peaks ) DrawText( PricePane, "2 peaks not detected. Try another symbol or load more data.", 0, 5, Color.Red ); } } }