public CADO(Bars bars, string description) public static CADO Series(Bars bars)
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() { // Use RSI to look for divergences between price and CADO WealthLab.LineStyle hist = WealthLab.LineStyle.Histogram; LineStyle ls = LineStyle.Solid; SetBarColors( Color.Silver, Color.Silver ); DataSeries RSIPrice = RSI.Series( Close, 10 ); DataSeries RSICado = RSI.Series( CADO.Series( Bars ), 10 ); DataSeries Diff = RSIPrice-RSICado; ChartPane CADOPane = CreatePane( 40, true, true ); ChartPane RSIPane = CreatePane( 50, true, true ); ChartPane DiffPane = CreatePane( 50, true, true ); DrawLabel( RSIPane, "RSI of Price and CADO" ); PlotSeries( CADOPane, CADO.Series( Bars ), Color.Brown, hist, 3 ); PlotSeries( RSIPane, RSIPrice, Color.Teal, ls, 1 ); PlotSeries( RSIPane, RSICado, Color.Brown, ls, 1 ); PlotSeries( DiffPane, Diff, Color.Gray, hist, 1 ); /* Both RSI and CADO are "unstable" indicators, and it requires starting the bar at least 3 times the period */ for(int bar = 30; bar < Bars.Count; bar++) { if( Diff[bar] > 30 ) SetBarColor( bar, Color.Red ); else if( Diff[bar] < -30 ) SetBarColor( bar, Color.DarkGreen ); } } } }