Guppy MMA oscillator

Author: mladen
Guppy MMA oscillator

The Guppy MMA Oscillator is a custom technical analysis tool designed to provide a visual representation of market momentum by analyzing multiple moving averages simultaneously. Unlike standard indicators that focus on a single price trend, this script aggregates a wide spectrum of data points to help identify the underlying "pulse" of the market.

Core Logic and Mechanism

The indicator operates based on three primary mathematical layers:

1. Multi-Period Aggregation The tool monitors twelve different timeframes (moving average periods) ranging from very short-term (3 periods) to longer-term (60 periods). By looking at these various windows at once, the script attempts to capture a holistic view of the market rather than focusing on just one specific speed of price movement.

2. Polarized Weighting (The "Guppy" Effect) This is where the unique logic resides. The script categorizes the moving averages into two distinct groups:

  • Short-Term Trends: Moving averages with periods shorter than 30 are treated as positive values. These represent immediate, fast-moving price action.
  • Long-Term Trends: Moving averages with periods of 30 and above are treated as negative values (subtracted from the total). These represent the heavier, slower structural trends of the market.

By summing the short-term trends and subtracting the long-term trends, the oscillator calculates the net "tension" between fast momentum and slow structure. When the resulting value is high, it indicates that short-term momentum is dominating; when low or negative, it suggests the longer-term trend is exerting more influence.

3. Smoothing and Signal Generation To ensure the data is readable and not overly erratic, the script applies two specific refinements:

  • Scaling: The resulting sum is multiplied by a factor of 10 to make the movements more distinct and easier to view on the chart's separate window.
  • Signal Smoothing: The tool calculates a secondary "signal" line using a weighted formula (similar to an Exponential Moving Average). This smooths out the primary oscillator data, helping traders distinguish between minor market noise and significant shifts in trend direction.

Visual Interpretation

The indicator appears in a separate window below the main price chart. It features two distinct lines:

  • The Primary Line: Shows the current real-time balance between short and long trends.
  • The Signal Line: Acts as a guide to confirm the strength of the primary line's movement.

By observing how these two lines interact relative to the zero level, users can get a clearer picture of whether the market is currently driven by immediate volatility or by established long-term momentum.

Indicators Used
Moving average indicator
14 Views
0 Downloads
0 Favorites
Guppy MMA oscillator
//+------------------------------------------------------------------+
//|                                          Guppy MMA oscilator.mq4 |
//|                                                           mladen |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link      "mladenfx@gmail.com"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1  LimeGreen
#property indicator_color2  Red
#property indicator_level1  0
#property indicator_levelcolor DarkSlateGray

//
//
//
//
//

extern int Price        = PRICE_CLOSE;
extern int SignalPeriod = 13;

//
//
//
//
//

double buffer1[];
double buffer2[];
double periods[]={3,5,8,10,12,15,30,35,40,45,50,60};
int    persize;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
{
   SetIndexBuffer(0,buffer1);
   SetIndexBuffer(1,buffer2);
   persize =ArraySize(periods);
   return(0);
}
int deinit() { return(0); }

//
//
//
//
//

int start()
{
   double alpha = 2.0/(1.0+SignalPeriod);
   int counted_bars=IndicatorCounted();
   int i,limit;

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
         limit = Bars-counted_bars;

   //
   //
   //
   //
   //

   for(i=limit; i>=0; i--)
   {
      double sum  = 0;
      for(int j=0; j<persize; j++)
      {
         if (periods[j]<30)
               sum  += iMA(NULL,0,periods[j],0,MODE_EMA,Price,i);
         else  sum  -= iMA(NULL,0,periods[j],0,MODE_EMA,Price,i);
      }
      buffer1[i] = sum*10.0;
      buffer2[i] = buffer2[i+1]+alpha*(buffer1[i]-buffer2[i+1]);
   }            
   return(0);
}

Comments