Loading…

Rainbow Oscillator

Rainbow charting builds ten moving averages by smoothing each one out of the one before it: the first band is a 2-bar simple moving average of price, the second band is a 2-bar simple moving average of the first band, and so on down the cascade. On a trending market the bands fan out and separate cleanly in one direction; on a range-bound market they bunch back together and criss-cross. This indicator turns that visual fan into two numbers rather than making you eyeball ten overlapping lines. Rainbow Spread % is the distance between the widest and narrowest band, expressed as a percent of the current close - a rising value means the bands are fanning out (a trend is developing), a falling value means they are collapsing back together (consolidation). Rainbow Position % is where the close currently sits inside that band spread, from 0% (at the tightest band) to 100% (at the widest), which reads like a Stochastic-style oscillator but measured against the rainbow's own bands instead of a fixed high/low window. The cascade is recomputed across the full available history on every call rather than carried forward incrementally between ticks. A 10-deep chain of 2-bar SMA-of-SMA smoothing has no clean closed-form warm-up length, so a full recompute is the only way to guarantee every bar's reading is exact; this trades some CPU for correctness, which is the right trade for a tool meant to be read on close, not scalped tick by tick. Notes and limitations - Needs at least InpLevels + 2 bars of history before it plots anything. - Recomputes the full visible history on every OnCalculate call by design (see above) - on very deep history with a small chart period this uses more CPU than an incremental indicator, though it stays well within normal terminal limits in practice. - This is a trend-strength/positioning gauge, not a signal generator - it issues no alerts and defines no entry rule.

Indicator · MT4 · v1.0 · Free

About Rainbow Oscillator

Rainbow Oscillator is an indicator for MetaTrader 4. It has 1 setting, such as Levels. MQL source code included.

Files in the download: RainbowOscillator.mq4, RainbowOscillator.txt.

Settings

SettingDefaultWhat it does
Levels10Cascade depth: number of recursive 2-bar SMA bands (2..10)

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Moving Average · Oscillator · Trend · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria