_i_FXGaugeMAs_lite





//+------------------------------------------------------------------+
//|                                           _i_FXGaugeMAs_lite.mq4 |
//|                                     Copyright © 2007, Doji Starr |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, 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;
extern int ShowBars   = 10000;
extern int LineWidth  = 1;

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

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



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
    
    IndicatorBuffers(7);
    
    SetIndexBuffer(0, buf_1);
    SetIndexEmptyValue(0,EMPTY_VALUE);
    SetIndexDrawBegin(0,MA_Period7);
    SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, LineWidth);
    SetIndexLabel(0, " MA 1 ( "+MA_Period1+" )");
    
    SetIndexBuffer(1, buf_2);
    SetIndexEmptyValue(1,EMPTY_VALUE);
    SetIndexDrawBegin(1,MA_Period7);
    SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, LineWidth);
    SetIndexLabel(1, " MA 2 ( "+MA_Period2+" )");
    
    SetIndexBuffer(2, buf_3);
    SetIndexEmptyValue(2,EMPTY_VALUE);
    SetIndexDrawBegin(2,MA_Period7);
    SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, LineWidth);
    SetIndexLabel(2, " MA 3 ( "+MA_Period3+" )");
    
    SetIndexBuffer(3, buf_4);
    SetIndexEmptyValue(3,EMPTY_VALUE);
    SetIndexDrawBegin(3,MA_Period7);
    SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, LineWidth);
    SetIndexLabel(3, " MA 4 ( "+MA_Period4+" )");
    
    SetIndexBuffer(4, buf_5);
    SetIndexEmptyValue(4,EMPTY_VALUE);
    SetIndexDrawBegin(4,MA_Period7);
    SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, LineWidth);
    SetIndexLabel(4, " MA 5 ( "+MA_Period5+" )");
    
    SetIndexBuffer(5, buf_6);
    SetIndexEmptyValue(5,EMPTY_VALUE);
    SetIndexDrawBegin(5,MA_Period7);
    SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, LineWidth);
    SetIndexLabel(5, " MA 6 ( "+MA_Period6+" )");
    
    SetIndexBuffer(6, buf_7);
    SetIndexEmptyValue(6,EMPTY_VALUE);
    SetIndexDrawBegin(6,MA_Period7);
    SetIndexStyle(6, DRAW_LINE, STYLE_SOLID, LineWidth);
    SetIndexLabel(6, " MA 7 ( "+MA_Period7+" )");
    
    return(0);
}

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

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
    
    startBar = ShowBars;
    
    if (startBar > Bars) { startBar = Bars-1; }
    
    if (startBar < MA_Period7*2 && goober < Time[0]) { Alert(" Increase ShowBars To At Least "+(MA_Period7*2+1)+" "); goober = Time[0]; }
    
    for (bar=0; bar<startBar; 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);
}





Sample





Analysis



Market Information Used:

Series array that contains open time of each bar


Indicator Curves created:


Implements a curve of type DRAW_LINE

Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen