This script is designed as a visual trading tool for the MetaTrader platform, specifically intended to help traders identify long-term market trends. It functions by calculating and plotting six different moving averages simultaneously on your price chart.
How it Works
The core logic of this script revolves around "smoothing" out price action to filter out temporary market noise. Instead of looking at every minor fluctuation in price, the tool calculates a series of Exponential Moving Averages (EMAs).
Each of the six lines represents a different time horizon:
- The first line tracks a shorter period (30 units).
- The subsequent lines gradually increase in length, moving from 35, 40, 45, and 50, up to a final long-term line of 60 units.
The Visual Objective
By displaying these six specific averages together, the script creates a visual "ribbon" or cluster. Because they are all based on different lengths but are plotted together, they allow a trader to see how various timeframes are reacting to current price movements:
- Trend Identification: When these lines move in the same direction, it provides a clearer picture of the prevailing trend.
- Momentum Analysis: The spacing between the lines helps indicate the strength of the trend; wider gaps often suggest stronger momentum, while tightening lines may indicate a period of consolidation or indecision.
- Support and Resistance: These lines can act as dynamic visual benchmarks, helping traders see where the market might react if the price pulls back.
Summary for Users
This tool is specifically configured as the "Long" version of the Guppy Multiple Moving Average (GMMA) strategy. Its purpose is to provide a multi-layered view of market sentiment. By observing how these six lines interact with one another, you can better identify significant shifts in price direction across multiple time scales at a single glance.
//+------------------------------------------------------------------+
//| 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_buffers 6
#property indicator_color1 Blue
#property indicator_color2 Blue
#property indicator_color3 Blue
#property indicator_color4 Blue
#property indicator_color5 Blue
#property indicator_color6 Blue
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexStyle(5,DRAW_LINE);
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