This script is a specialized technical analysis tool designed to help traders visualize short-term price trends on a trading chart. It functions by calculating and displaying five distinct "Exponential Moving Averages" (EMAs) simultaneously, which act as a visual representation of recent market momentum.
How the Logic Works
The primary objective of this script is to smooth out the "noise" of constant price fluctuations to reveal the underlying direction of the market. It achieves this through the following logic:
- Multi-Layered Analysis: Instead of relying on a single average, the script tracks five different time horizons at once. These ranges are set at 3, 7, 10, 12, and 15 periods.
- Exponential Weighting: By using Exponential Moving Averages (EMA), the logic gives more importance to the most recent price data. This allows the indicator to react more quickly to sudden market shifts compared to a standard simple moving average.
- Short-Term Focus: Because these timeframes are relatively small, this specific version of the tool is designed to identify immediate trends. It helps traders see how fast the price is moving in the "here and now."
- Visual Correlation: On your chart, these five averages appear as a group of lines. When these lines move in harmony (e.g., all sloping upward), it suggests a strong, unified short-term trend. When they begin to diverge or tangle, it can signal a potential loss of momentum or a transition in market sentiment.
Summary for the Trader
By observing how these five lines interact with one another, you can gain a clearer picture of market velocity. This tool helps you distinguish between temporary price spikes and actual sustained moves, providing a smoother, more reliable visual guide for identifying short-term opportunities.
//+------------------------------------------------------------------+
//| Guppy Mulitple Moving Average (Short).mq4 |
//| Code written by - Matt Trigwell |
//| |
//+------------------------------------------------------------------+
// ***** 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
// ***** INSTRUCTIONS *****
// Add the GMMA Short indicator and the GMMA Long indicator to your charts.
// This is the GMMA Short indicator
#property copyright "Code written by - Matt Trigwell"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 ForestGreen
#property indicator_color2 ForestGreen
#property indicator_color3 ForestGreen
#property indicator_color4 ForestGreen
#property indicator_color5 ForestGreen
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
//+------------------------------------------------------------------+
//| 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);
//----
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,3,0,MODE_EMA,PRICE_CLOSE,i);
ExtMapBuffer2[i]=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i);
ExtMapBuffer3[i]=iMA(NULL,0,10,0,MODE_EMA,PRICE_CLOSE,i);
ExtMapBuffer4[i]=iMA(NULL,0,12,0,MODE_EMA,PRICE_CLOSE,i);
ExtMapBuffer5[i]=iMA(NULL,0,15,0,MODE_EMA,PRICE_CLOSE,i);
}
return(0);
}
//+------------------------------------------------------------------+
Comments