UltimateOsc

Modified on 2008/05/03 16:16 by Administrator — Categorized as: Standard Indicators

Syntax

public static UltimateOsc Series(Bars bars) public UltimateOsc(Bars bars, string description)

Parameter Description

bars The Bars object

Description

Williams' Ultimate Oscillator uses weighted sums of three oscillators, each using a different time period (7, 14, and 28), which represent short, medium, and long term market trends. The Ultimate Oscillator moves within the range of 0 to 100.

Interpretation

Williams recommended method of interpreting the Ultimate Oscillator is to look for divergences between the indicator value and price. For example, a bullish divergence occurs when prices make a lower low, but the Ultimate Oscillator fails to make a lower low.

Example

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 ); } } } }