public AdaptiveLookback(Bars bars, int howManySwings, bool UseAll, string description) public AdaptiveLookback(Bars bars, int howManySwings, bool UseAll, bool fastSwing, string description) public AdaptiveLookback(Bars bars, int howManySwings, bool UseAll, bool fastSwing, bool preciseDetection, string description)public AdaptiveLookback(Bars bars, bool fastSwing, string description) public AdaptiveLookback(Bars bars, bool fastSwing, bool preciseDetection, string description)public static AdaptiveLookback Series(Bars bars, int howManySwings, bool UseAll)
public AdaptiveLookback(Bars bars, bool fastSwing, string description) public AdaptiveLookback(Bars bars, bool fastSwing, bool preciseDetection, string description)
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 AdaptiveLookbackDemo : WealthScript { private StrategyParameter paramSwings; public AdaptiveLookbackDemo() { paramSwings = CreateParameter("Nr. of swings", 6, 1, 20, 1); } protected override void Execute() { // Create an instance of the AdaptiveLookback indicator class AdaptiveLookback ap = AdaptiveLookback.Series( Bars, paramSwings.ValueInt, false ); DataSeries adaptiveRSI = new DataSeries( Bars, "Adaptive RSI" ); RSI rsi = RSI.Series(Close, 14); // Build the adaptive RSI series for (int bar = ap.FirstValidValue; bar < Bars.Count; bar++) adaptiveRSI[bar] = RSI.Series( Close, Math.Max( 1, (int)ap[bar] ) )[bar]; LineStyle solid = LineStyle.Solid; ChartPane arPane = CreatePane( 50, true, true ); HideVolume(); PlotSeries( arPane, adaptiveRSI, Color.Blue, solid, 2 ); PlotSeries( arPane, rsi, Color.DarkBlue, solid, 1 ); DrawHorzLine( arPane, 70.0, Color.Red, LineStyle.Dashed, 1 ); DrawHorzLine( arPane, 30.0, Color.Blue, LineStyle.Dashed, 1 ); } } }
Adaptive RSI (CSCO, 30-minute)
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 AdaptiveLookbackDemo : WealthScript { private StrategyParameter paramSwings; public AdaptiveLookbackDemo() { paramSwings = CreateParameter("Nr. of swings", 6, 1, 20, 1); } protected override void Execute() { // Create an instance of the AdaptiveLookback indicator class AdaptiveLookback ap = new AdaptiveLookback( Bars, false, "Parameterless Adaptive Lookback" ); AdaptiveLookback apFast = new AdaptiveLookback( Bars, true, "Parameterless Adaptive Lookback (Fast)" ); DataSeries adaptiveRSI = new DataSeries( Bars, "Adaptive RSI" ); DataSeries adaptiveRSIFast = new DataSeries( Bars, "Adaptive RSI (Fast)" ); RSI rsi = RSI.Series(Close, 14); // Build the adaptive RSI series for (int bar = ap.FirstValidValue; bar < Bars.Count; bar++) { adaptiveRSI[bar] = RSI.Series( Close, Math.Max( 1, (int)ap[bar] ) )[bar]; adaptiveRSIFast[bar] = RSI.Series( Close, Math.Max( 1, (int)apFast[bar] ) )[bar]; } LineStyle solid = LineStyle.Solid; ChartPane arPane = CreatePane( 50, true, true ); HideVolume(); PlotSeries( arPane, adaptiveRSI, Color.Blue, solid, 2 ); PlotSeries( arPane, adaptiveRSIFast, Color.Red, solid, 1 ); PlotSeries( arPane, rsi, Color.Silver, solid, 1 ); DrawHorzLine( arPane, 70.0, Color.Red, LineStyle.Dashed, 1 ); DrawHorzLine( arPane, 30.0, Color.Blue, LineStyle.Dashed, 1 ); ChartPane alPane1 = CreatePane( 40, true, true ); PlotSeries( alPane1, ap, Color.Blue, solid, 1 ); PlotSeries( alPane1, apFast, Color.Red, solid, 1 ); DrawHorzLine( alPane1, 14, Color.Silver, LineStyle.Dashed, 1 ); } } }
Parameterless Adaptive RSI