guppy_multiple_moving_averages

Author: Copyright 2015, Dmitriy Kudryashov, Katyusha Software Corp.
guppy_multiple_moving_averages

This technical script is designed to implement the "Guppy Multiple Moving Averages" (GMMA) strategy on a trading chart. It serves as a visual analysis tool that helps traders identify trends, momentum, and potential reversals by grouping multiple moving averages into distinct categories.

Core Logic Overview

The indicator works by layering thirteen different Exponential Moving Averages (EMAs) onto your price chart simultaneously. Rather than looking at just one line, this tool creates a "ribbon" of data that represents various timeframes and sensitivities. These lines are categorized into three specific groups:

1. The Fast Group (Fast Moving Averages) The first six lines in the script represent short-term market sentiment. By using very short periods (ranging from 3 to 15), these lines react quickly to recent price changes. When these lines move together, they indicate immediate momentum.

2. The Slow Group (Slow Moving Averages) The next six lines represent medium-to-long-term trends (ranging from 30 to 60). These are less sensitive to "noise" and minor price fluctuations. They provide a clearer picture of the established trend over a broader period of time.

3. The Main Control Line The final line in the script is a long-term moving average (set to a 200-period default). This serves as the "anchor" or the ultimate trend filter for the entire chart, helping to distinguish between major bullish and bearish cycles.

How it Works in Practice

By viewing all these lines at once, the logic allows you to see the health of a trend through visual cues:

  • Trend Strength: When the "Fast Group" is clustered tightly and moving in the same direction as the "Slow Group," it suggests a strong, healthy trend.
  • Momentum Shifts: If the Fast Group begins to fan out or change direction while the Slow Group remains steady, it can indicate that short-term momentum is shifting, potentially signaling an upcoming change in the market's direction.
  • Trend Alignment: The "Main Moving Average" acts as a final confirmation. Traders typically look for the price to be on the correct side of this line to determine the primary market bias (e.g., only looking for buy opportunities when the price is above it).

In summary, this script transforms complex mathematical data into a visual map, allowing you to see the "speed" and "weight" of market movements at a single glance.

Indicators Used
Moving average indicator
8 Views
0 Downloads
0 Favorites
guppy_multiple_moving_averages
//+------------------------------------------------------------------+
//|                               Guppy Multiple Moving Averages.mq4 |
//|       Copyright 2015, Dmitriy Kudryashov,Katyusha Software Corp. |
//|                       https://www.mql5.com/ru/users/dlim0n4ik.dk |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, Dmitriy Kudryashov, Katyusha Software Corp."
#property link      "https://www.mql5.com/ru/users/dlim0n4ik.dk"
#property version   "1.00"
#property strict
#property description "Ñ ïîìîùüþ äàííîãî èíäèêàòîðà ðåàëèçóåòñÿ äíåâíàÿ ñòðàòåãèÿ Äåðèëà Ãóïïè (Daryl Guppy)."
#property indicator_chart_window
#property indicator_buffers 13
#property indicator_plots   13
//--- plot fMA0
#property indicator_label1  "fMA0"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- plot fMA1
#property indicator_label2  "fMA1"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrRed
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1
//--- plot fMA2
#property indicator_label3  "fMA2"
#property indicator_type3   DRAW_LINE
#property indicator_color3  clrRed
#property indicator_style3  STYLE_SOLID
#property indicator_width3  1
//--- plot fMA3
#property indicator_label4  "fMA3"
#property indicator_type4   DRAW_LINE
#property indicator_color4  clrRed
#property indicator_style4  STYLE_SOLID
#property indicator_width4  1
//--- plot fMA4
#property indicator_label5  "fMA4"
#property indicator_type5   DRAW_LINE
#property indicator_color5  clrRed
#property indicator_style5  STYLE_SOLID
#property indicator_width5  1
//--- plot fMA5
#property indicator_label6  "fMA5"
#property indicator_type6   DRAW_LINE
#property indicator_color6  clrRed
#property indicator_style6  STYLE_SOLID
#property indicator_width6  1
//--- plot sMA0
#property indicator_label7  "sMA0"
#property indicator_type7   DRAW_LINE
#property indicator_color7  clrGreen
#property indicator_style7  STYLE_SOLID
#property indicator_width7  1
//--- plot sMA1
#property indicator_label8  "sMA1"
#property indicator_type8   DRAW_LINE
#property indicator_color8  clrGreen
#property indicator_style8  STYLE_SOLID
#property indicator_width8  1
//--- plot sMA2
#property indicator_label9  "sMA2"
#property indicator_type9   DRAW_LINE
#property indicator_color9  clrGreen
#property indicator_style9  STYLE_SOLID
#property indicator_width9  1
//--- plot sMA3
#property indicator_label10  "sMA3"
#property indicator_type10   DRAW_LINE
#property indicator_color10  clrGreen
#property indicator_style10  STYLE_SOLID
#property indicator_width10  1
//--- plot sMA4
#property indicator_label11  "sMA4"
#property indicator_type11   DRAW_LINE
#property indicator_color11  clrGreen
#property indicator_style11  STYLE_SOLID
#property indicator_width11  1
//--- plot sMA5
#property indicator_label12  "sMA5"
#property indicator_type12   DRAW_LINE
#property indicator_color12  clrGreen
#property indicator_style12  STYLE_SOLID
#property indicator_width12  1
//--- plot mMA
#property indicator_label13  "mMA"
#property indicator_type13   DRAW_LINE
#property indicator_color13  clrBlue
#property indicator_style13  STYLE_SOLID
#property indicator_width13  1
//+------------------------------------------------------------------+
//| Ââîäíûå ïàðàìåòðû Moving Average                                 |
//+------------------------------------------------------------------+
//--- Ïàðàìåòðû Fast Moving Average ----------------------------------
input string                  fMA_Info="Ïàðàìåòðû Fast Moving Average";
input int      fMA0_Period=3;    // Ïåðèîä Moving Average 01
input int      fMA1_Period=5;    // Ïåðèîä Moving Average 02
input int      fMA2_Period=8;    // Ïåðèîä Moving Average 03
input int      fMA3_Period=10;   // Ïåðèîä Moving Average 04
input int      fMA4_Period=12;   // Ïåðèîä Moving Average 05
input int      fMA5_Period=15;   // Ïåðèîä Moving Average 06
//---
//--- Ïàðàìåòðû Slow Moving Average ----------------------------------
input string                  sMA_Info="Ïàðàìåòðû Slow Moving Average";
input int      sMA0_Period=30;   // Ïåðèîä Moving Average 07
input int      sMA1_Period=35;   // Ïåðèîä Moving Average 08
input int      sMA2_Period=40;   // Ïåðèîä Moving Average 09
input int      sMA3_Period=45;   // Ïåðèîä Moving Average 10
input int      sMA4_Period=50;   // Ïåðèîä Moving Average 11
input int      sMA5_Period=60;   // Ïåðèîä Moving Average 12
//---
//--- Ïàðàìåòðû Main Moving Average ----------------------------------
input string                  mMA_Info="Ïàðàìåòðû Main Moving Average";
input int      mMA_Period=200;   // Ïåðèîä êîíòðîëüíîé Moving Average
//+------------------------------------------------------------------+
//--- indicator buffers
double         fMA0Buffer[];
double         fMA1Buffer[];
double         fMA2Buffer[];
double         fMA3Buffer[];
double         fMA4Buffer[];
double         fMA5Buffer[];
double         sMA0Buffer[];
double         sMA1Buffer[];
double         sMA2Buffer[];
double         sMA3Buffer[];
double         sMA4Buffer[];
double         sMA5Buffer[];
double         mMABuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,fMA0Buffer);
   SetIndexBuffer(1,fMA1Buffer);
   SetIndexBuffer(2,fMA2Buffer);
   SetIndexBuffer(3,fMA3Buffer);
   SetIndexBuffer(4,fMA4Buffer);
   SetIndexBuffer(5,fMA5Buffer);
   SetIndexBuffer(6,sMA0Buffer);
   SetIndexBuffer(7,sMA1Buffer);
   SetIndexBuffer(8,sMA2Buffer);
   SetIndexBuffer(9,sMA3Buffer);
   SetIndexBuffer(10,sMA4Buffer);
   SetIndexBuffer(11,sMA5Buffer);
   SetIndexBuffer(12,mMABuffer);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int limit=rates_total-prev_calculated;
//---
   for(int i=0; i<limit; i++)
     {
//--- Ðàñ÷åò Fast Moving Average -------------------------------------
      fMA0Buffer[i]=iMA(NULL,0,fMA0_Period,0,MODE_EMA,PRICE_CLOSE,i);
      fMA1Buffer[i]=iMA(NULL,0,fMA1_Period,0,MODE_EMA,PRICE_CLOSE,i);
      fMA2Buffer[i]=iMA(NULL,0,fMA2_Period,0,MODE_EMA,PRICE_CLOSE,i);
      fMA3Buffer[i]=iMA(NULL,0,fMA3_Period,0,MODE_EMA,PRICE_CLOSE,i);
      fMA4Buffer[i]=iMA(NULL,0,fMA4_Period,0,MODE_EMA,PRICE_CLOSE,i);
      fMA5Buffer[i]=iMA(NULL,0,fMA5_Period,0,MODE_EMA,PRICE_CLOSE,i);
//---
//--- Ðàñ÷åò Slow Moving Average -------------------------------------
      sMA0Buffer[i]=iMA(NULL,0,sMA0_Period,0,MODE_EMA,PRICE_CLOSE,i);
      sMA1Buffer[i]=iMA(NULL,0,sMA1_Period,0,MODE_EMA,PRICE_CLOSE,i);
      sMA2Buffer[i]=iMA(NULL,0,sMA2_Period,0,MODE_EMA,PRICE_CLOSE,i);
      sMA3Buffer[i]=iMA(NULL,0,sMA3_Period,0,MODE_EMA,PRICE_CLOSE,i);
      sMA4Buffer[i]=iMA(NULL,0,sMA4_Period,0,MODE_EMA,PRICE_CLOSE,i);
      sMA5Buffer[i]=iMA(NULL,0,sMA5_Period,0,MODE_EMA,PRICE_CLOSE,i);
//---
//--- Ðàñ÷åò Main Moving Average -------------------------------------
      mMABuffer[i]=iMA(NULL,0,mMA_Period,0,MODE_EMA,PRICE_CLOSE,i);
     }
   return(rates_total);
  }
//+------------------------------------------------------------------+

Comments