public static UltimateOsc Series(Bars bars) public UltimateOsc(Bars bars, string description)
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() { // Look for bullish divergences between Ultimate Oscillator and Price double t1, t2; int t1bar = -1; bool UUp = false; bool PUp = false; ChartPane UltOscPane = CreatePane( 40, true, true ); PlotSeries( UltOscPane, UltimateOsc.Series( Bars ), Color.Black, WealthLab.LineStyle.Solid, 2 ); PeakTroughMode ptmode = PeakTroughMode.Value;// ( #AsPoint ); DataSeries UTrough = Trough.Series( UltimateOsc.Series( Bars ), 10, ptmode ); PlotSeries( UltOscPane, UTrough, Color.Green, LineStyle.Dots, 5 ); DataSeries PTrough = Trough.Series( Close, 10, ptmode ); PlotSeries( PricePane, PTrough, Color.Green, LineStyle.Dots, 3 ); for(int bar = 100; bar < Bars.Count; bar++) { t1 = Trough.Value( bar, UltimateOsc.Series( Bars ), 10, ptmode ); if( t1 != -1 ) t1bar = bar; t2 = Trough.Value( t1bar, UltimateOsc.Series( Bars ), 10, ptmode ); UUp = ( t1 > t2 ); t1 = Trough.Value( bar, Close, 10, ptmode ); if( t1 != -1 ) t1bar = bar; t2 = Trough.Value( t1bar, Close, 10, ptmode ); PUp = ( t1 > t2 ); if( UUp & !PUp ) SetBarColor( bar, Color.Green ); } } } }