GMMA Long_v2
Download scriptThe Guppy Multiple Moving Average (GMMA) Long script is a technical analysis tool designed to help traders visualize and identify market trends by analyzing price momentum over different time horizons. Instead of relying on a single moving average, this script plots six distinct lines on your chart simultaneously, representing various periods of the market's history.
How the Logic Works
The core logic of this script is based on "exponential" smoothing. It takes the closing prices of an asset and calculates six different averages at once. Each of these lines tracks a specific timeframe: 30, 35, 40, 45, 50, and 60 periods.
By looking at these six lines together as a group, the script helps you see the "health" of a trend:
- Short-Term Momentum: The lines with smaller periods (like 30 and 35) react more quickly to recent price changes. They represent what is happening right now in the market.
- Long-Term Trend: The lines with larger periods (like 50 and 60) are slower to move, representing the broader, underlying direction of the market.
How to Interpret the Results
The power of this script lies in the relationship between these six lines:
- Trend Identification: When all six lines are moving in the same direction (all pointing up or all pointing down), it suggests a very strong and stable trend is in place.
- Momentum Shifts: If the shorter-term lines begin to cross or move away from the longer-term lines, it can indicate that the current momentum is accelerating or beginning to lose steam.
- Support and Resistance: The cluster of these six lines often acts as a "zone." In an uptrend, these lines frequently act as a floor (support) where the price might bounce back up; in a downtrend, they can act as a ceiling (resistance).
In summary, this script transforms complex price data into a visual "ribbon" of information. It allows you to see at a glance whether the immediate price action is in harmony with the long-term trend, making it easier to spot potential entries and exits in the market.
//+------------------------------------------------------------------+
//| Guppy Mulitple Moving Average (Long).mq4 |
//| Code written by - Matt Trigwell |
//| |
//+------------------------------------------------------------------+
// ***** INSTRUCTIONS *****
// Add the GMMA Short indicator and the GMMA Long indicator to your charts.
// This is the GMMA Long indicator
// ***** For information on how to use this fantastic indicator *****
// http://www.guppytraders.com/
// http://www.market-analyst.com/kb/article.php/Guppy_Multiple_Moving_Average
// http://tradermike.net/2004/05/another_look_at_multiple_moving_averages
#property copyright "Code written by - Matt Trigwell"
#property indicator_chart_window
//#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 LightSalmon
#property indicator_color2 LightSalmon
#property indicator_color3 LightSalmon
#property indicator_color4 LightSalmon
#property indicator_color5 LightSalmon
#property indicator_color6 LightSalmon
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
//+------------------------------------------------------------------+
//| 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);
//----
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,30,0,MODE_EMA,PRICE_CLOSE,i);
ExtMapBuffer2[i]=iMA(NULL,0,35,0,MODE_EMA,PRICE_CLOSE,i);
ExtMapBuffer3[i]=iMA(NULL,0,40,0,MODE_EMA,PRICE_CLOSE,i);
ExtMapBuffer4[i]=iMA(NULL,0,45,0,MODE_EMA,PRICE_CLOSE,i);
ExtMapBuffer5[i]=iMA(NULL,0,50,0,MODE_EMA,PRICE_CLOSE,i);
ExtMapBuffer6[i]=iMA(NULL,0,60,0,MODE_EMA,PRICE_CLOSE,i);
}
return(0);
}
//+------------------------------------------------------------------+
Comments