_i_FXGaugeMAs

Download script
Author: Copyright � 2006, Doji Starr
_i_FXGaugeMAs

This technical tool is designed to provide a comprehensive visual overview of market trends by calculating and displaying multiple Moving Averages simultaneously on a single price chart. Instead of relying on just one indicator, this script creates a multi-layered map of historical price data to help traders identify the overall direction and momentum of the currency market.

How the Logic Works

The core logic of this tool revolves around "Smoothing." By taking the closing prices of assets over specific periods of time, the script calculates an average price for each period. This filters out the "noise" of minor, rapid price fluctuations, making it easier to see the broader trend.

The script processes seven different time horizons at once. Each horizon uses a distinct numerical period (ranging from 21 up to 233):

  • Short-Term Tracking: The smaller periods react more quickly to recent price changes, helping to highlight immediate momentum.
  • Medium to Long-Term Tracking: The larger periods provide a much slower, broader view of the market's "path." These act as significant structural lines that show where the price has been heading over weeks or months.

Visualizing the Data

The script automatically draws these seven moving averages as distinct lines on your chart. By observing how these lines interact with one another, users can interpret various market conditions:

  • Trend Identification: When the lines are slanted upward and ordered from shortest to longest, it typically indicates a sustained bullish trend. A downward slant suggests a bearish trend.
  • Support and Resistance: The longer-period lines (such as the 144 and 233 periods) often act as significant "floors" or "ceilings" where the price may react or bounce.
  • Convergence and Divergence: You can see where different timeframes agree or disagree. When the lines are tightly bunched together, it suggests a period of consolidation; when they fan out, it indicates increasing momentum in a specific direction.

In summary, this tool transforms raw price data into a multi-layered visual guide, allowing you to see the "big picture" of market trends across various timeframes at a single glance.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
_i_FXGaugeMAs
//+------------------------------------------------------------------+
//|                                                _i_FXGaugeMAs.mq4 |
//|                                     Copyright © 2006, Doji Starr |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Doji Starr"

#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Lime
#property indicator_color2 Brown
#property indicator_color3 Magenta
#property indicator_color4 DarkSlateGray
#property indicator_color5 Yellow
#property indicator_color6 LightSlateGray
#property indicator_color7 White



// input params
extern int MA_Period1 = 21;
extern int MA_Period2 = 34;
extern int MA_Period3 = 55;
extern int MA_Period4 = 75;
extern int MA_Period5 = 100;
extern int MA_Period6 = 144;
extern int MA_Period7 = 233;

// vars
int counted_bars, startBar, bar, i;

// buffers
double buf_1[], buf_2[], buf_3[], buf_4[], buf_5[], buf_6[], buf_7[];



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
    SetIndexBuffer(0, buf_1);
    SetIndexBuffer(1, buf_2);
    SetIndexBuffer(2, buf_3);
    SetIndexBuffer(3, buf_4);
    SetIndexBuffer(4, buf_5);
    SetIndexBuffer(5, buf_6);
    SetIndexBuffer(6, buf_7);

    SetIndexStyle(0, DRAW_LINE, EMPTY, 2);
    SetIndexStyle(1, DRAW_LINE, EMPTY, 2);

    return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
    return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
    counted_bars = IndicatorCounted();
    startBar = Bars-counted_bars-1;

    for (bar=startBar; bar>=0; bar--)
    {
        buf_1[bar] = iMA(NULL, 0, MA_Period1, 0, MODE_SMA, PRICE_CLOSE, bar);
        buf_2[bar] = iMA(NULL, 0, MA_Period2, 0, MODE_SMA, PRICE_CLOSE, bar);
        buf_3[bar] = iMA(NULL, 0, MA_Period3, 0, MODE_SMA, PRICE_CLOSE, bar);
        buf_4[bar] = iMA(NULL, 0, MA_Period4, 0, MODE_SMA, PRICE_CLOSE, bar);
        buf_5[bar] = iMA(NULL, 0, MA_Period5, 0, MODE_SMA, PRICE_CLOSE, bar);
        buf_6[bar] = iMA(NULL, 0, MA_Period6, 0, MODE_SMA, PRICE_CLOSE, bar);
        buf_7[bar] = iMA(NULL, 0, MA_Period7, 0, MODE_SMA, PRICE_CLOSE, bar);
    }
    
    return(0);
}

Comments