Rajandran R Creator of OpenAlgo Sketchmaker, RagZ. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Now the recent curiosity on building Trading AI Agents.

Rainbow Oscillator and Nifty

1 min read

Watercolor illustration of rainbow moving average lines over a chart for the Rainbow oscillator

Another Trend Following Indicator under my observation other than NMA Swing Trading is Rainbow Oscillator

The Rainbow Charts and Rainbow Oscillator indicators were created by Mel Widner, Ph.D. and originally introduced in the July 1997 issue of Stocks and Commodities magazine.

The Rainbow Oscillator is a trend-following indicator .The Rainbow Oscillator is derived from a consensus of the Rainbow Charts trends. It defines the highest high and lowest low of those moving averages to create an oscillator and bandwidth lines based on those calculations.Rainbow Charts uses 2-period simple moving average. Recursive smoothing is then applied to the original moving average thereby creating 9additional moving averages; each new moving average is based on the previous moving average. Rainbow Oscillator is applied to Nifty Charts. And to Simply Understand the chart Blue lines between the Rainbow Band indicates upper trend and the Red lines between the Rainbow Band Indicates negative trend.

AFL Code for Rainbow Oscillator

_SECTION_BEGIN(“Rainbow Oscillator”);
/* Rainbow Oscillator */
/* July 1997 TASC Traders Tips*/
/* Coded by Anthony Faragasso */

MaxGraph =16;

avg1= Max (MA(C,2),
Max (MA(MA(C,2),2),
Max (MA(MA(MA(C,2),2),2),
Max (MA(MA(MA(MA(C,2),2),2),2),
Max(MA(MA(MA(MA(MA(C,2),2),2),2),2),
Max(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),
Max(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),
Max(MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),2),
Max(MA(MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),2),2),

MA(MA(MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),2),2),2))))))))));;;;;;;;;

avg2 = Min(MA(C,2),
Min(MA(MA(C,2),2),
Min(MA(MA(MA(C,2),2),2),
Min(MA(MA(MA(MA(C,2),2),2),2),
Min(MA(MA(MA(MA(MA(C,2),2),2),2),2),
Min(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),
Min(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),
Min(MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),2),
Min(MA(MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),2),2),

MA(MA(MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),2),2),2))))))))));;;;;;;;;;

/* Rainbow Oscillator */

Graph0 = 100 * (Close – ((MA(C,2)+
MA(MA(C,2),2)+
MA(MA(MA(C,2),2),2) + MA(MA(MA(MA(C,2),2),2),2) +
MA(MA(MA(MA(MA(C,2),2),2),2),2) +
MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2) +
MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2)+
MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),2)+
MA(MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),2),2)+

MA(MA(MA(MA(MA(MA(MA(MA(MA(MA(C,2),2),2),2),2),2),2),2),2),2))
/10))/(HHV(C,10)-LLV(C,10));

/* Lower Rainbow Band */

Graph1 = -100 *( avg1 – avg2) /
(HHV(C,10) – LLV(C,10));

/* Upper Rainbow Band */

Graph2 = 100 * (avg1 – avg2) /
(HHV(C,10) – LLV(C,10));

Graph0Style = 3;
Graph2Style = Graph1Style = 1;
Graph2Color = Graph1Color =3;
Graph3 = 0;
Graph3Color =8;

downbar =Graph0 <Ref( Graph3,-1);
upbar = Graph0 > Ref(Graph3,-1);
barcolor = IIf( downbar,4, IIf( upbar, 6, 0 ) );
Graph0BarColor = ValueWhen( barcolor != 0, barcolor );

Title = Name() +” Rainbow Oscillator : “+WriteVal(Graph0,format=1.2) +” % “;
_SECTION_END();

Source:
www.marketcalls.in

Marketcalls Elite Traders Club

MEMBERSHIP

Marketcalls Elite Traders Club

Every Marketcalls course and live mentorship in one membership: 127 courses and 2,500+ hours of learning.

  • Market Profile, Orderflow, AFL, Pine Script and Python
  • Live mentorship and TradEdge trading room
  • Premium tools and the Elite Slack community

Learn by watching: free videos every week

Market Profile, order flow, Python, AI and OpenAlgo tutorials on YouTube.

Rajandran R Creator of OpenAlgo Sketchmaker, RagZ. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Now the recent curiosity on building Trading AI Agents.

7 Replies to “Rainbow Oscillator and Nifty”

  1. @mahisRainbow Oscillator uses Recusive moving average technique to for optimization which is missing in Elder Bull ray and Bear ray. Its compleletly different in producing signals

  2. When put this AFL–there is some error:ERROR-29:Variable UPBAR used without being initialized–How can I correct it ?(AMI-4.80.2 PROF)

  3. Sir Waiting for Three White Shoulders and Three Black Crows Patterns and understanding……….. coz u r the perfect roll model for technical

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More