Syntax
public RainbowOsc(DataSeries ds, int period, int levels, string description): base(ds, description)
public static RainbowOsc Series (DataSeries ds, int period, int levels )
Parameter Description
ds | DataSeries used to build Rainbow Oscillator |
period | Lookback period |
levels | Number of levels |
Description
Rainbow Oscillator by Mel Widner, Ph.D., was introduced in July 1997 issue of Stocks and Commodities magazine. It is a trend changing indicator.
The Rainbow Oscillator is based on a recursively smoothed (usually ten times) simple moving average (usually two-period). The oscillator derives a market consensus from this repetitive smoothing.
Interpretation
When the oscillator goes beyond 80 or below 20, the market becomes more and more unstable, so there's a higher chance of a sudden reversal. When the oscillator becomes more and more flat, the market tends to remain more stable.
Example
The following example illustrates plotting Rainbow Oscillator together with companion Rainbow Charts lines:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using TASCIndicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
Random r = new Random();
private Color RandomColor()
{
Color randomColor = Color.FromArgb(r.Next(255), r.Next(255), r.Next(255));
return randomColor;
}
protected override void Execute()
{
DataSeries Price = Close;
int Length = 2, Level = 10;
List lst = new List();
lst.Add( SMA.Series(Price, Length) );
// Rainbow Charts
for( int i = 1; i < Level; i++ )
{
DataSeries ds = SMA.Series( lstlst.Count - 1, Length );
ds.Description = string.Format( "Rainbow({0})", i );
lst.Add( ds );
PlotSeries( PricePane, ds, RandomColor(), LineStyle.Solid, 1 );
}
// Rainbow Oscillator
DataSeries RO = RainbowOsc.Series( Price, Length, Level );
ChartPane roPane = CreatePane( 30,true,true );
PlotSeries( roPane, RO, Color.Blue, LineStyle.Histogram, 3 );
}
}
}