RainbowMMA_11

Download script
Author: Code written by - Akuma99
RainbowMMA_11

The Rainbow MMA 1 is a technical analysis tool designed to provide traders with a visual representation of momentum and trend direction by smoothing out price fluctuations. Instead of looking at raw, jagged price movements, this indicator filters out "noise" to help identify the underlying market structure more clearly.

How the Logic Works

The core logic of this script revolves around the use of Exponential Moving Averages (EMA). Unlike a simple average, an exponential moving average gives more importance to the most recent price data, allowing it to react more quickly to new information while still maintaining a smooth curve.

To create the "Rainbow" effect, the script calculates six different versions of this moving average simultaneously. Each one uses a slightly different look-back period:

  • Layered Smoothing: The script tracks six distinct lines based on timeframes ranging from 2 to 7 units.
  • Dynamic Clustering: Because these periods are so close together (2, 3, 4, 5, 6, and 7), the resulting lines stay tightly grouped together.
  • Trend Identification: When these lines move in the same direction, they cluster together to signal a strong trend. When they begin to spread apart or cross one another, it indicates a potential change in momentum or a period of market indecision.

Visual Experience for the Trader

From a user perspective, this tool acts as a multi-layered ribbon on your chart. By displaying eight data points (derived from these six primary calculations), the indicator provides a "thick" visual flow.

This allows you to see:

  1. Trend Strength: If the lines are tightly packed and moving upward or downward, the current trend is healthy.
  2. Volatility Awareness: If the lines begin to "fan out" or diverge significantly, it suggests that price volatility is increasing or that the market is losing its clear direction.
  3. Support and Resistance: The cluster of lines serves as a visual guide for where the price might find support (in an uptrend) or resistance (in a downtrend).
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
17 Views
0 Downloads
0 Favorites
RainbowMMA_11
/*

*********************************************************************
          
                        Rainbow MMA 1
                   Copyright © 2006  Akuma99
                  http://www.beginnertrader.com
                  
*********************************************************************

*/


#property copyright "Code written by - Akuma99"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Gold
#property indicator_color2 Gold
#property indicator_color3 Gold
#property indicator_color4 Gold
#property indicator_color5 Gold
#property indicator_color6 Gold
#property indicator_color7 Gold
#property indicator_color8 Gold

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexStyle(6,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(6,ExtMapBuffer7);
   SetIndexStyle(7,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(7,ExtMapBuffer8);
//----
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   int i,j,limit,counted_bars=IndicatorCounted();
   
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
   for(i=0; i<limit; i++){
      ExtMapBuffer1[i]=iMA(NULL,0,2,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer2[i]=iMA(NULL,0,3,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer3[i]=iMA(NULL,0,4,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer4[i]=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer5[i]=iMA(NULL,0,6,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer6[i]=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i);
   }
   

   return(0);
  }
//+------------------------------------------------------------------+

Comments