Several Moving Average Indicator For MT4
The Several Moving Average Indicator For MT4 is an indicator that draws a five moving averages on the trading chart. Traders can customize the smoothing method, period and timeframe of each of the moving averages. By plotting the five of moving averages, traders are able to compare the signals from different moving averages and also get confirmed signals by the five MAs. Just like any other moving average indicator, the indicator is a trend following indicator that shows the prevailing market trend. It also gives buy and sell signals. A buy signal is given when the moving average lines cross as they begin moving upwards. Likewise, the indicator gives a sell signal when the moving averages cross as they begin to move downwards.
Installing the Several Moving Average Indicator For MT4
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file several_moving_average.mq4 into the folder MQL4\Indicators of your MT4 installation. After that please restart MT4 and then you will be able to see the indicator in the list of indicators.
Parameters of the Several Moving Average Indicator For MT4
The Several Moving Average Indicator For MT4 has 30 parameters to configure.
input string MA1_Info="Ïàðàìåòðû Moving Average 1";
input ENUM_TIMEFRAMES MA1_TFPeriod = 0; // ïåðèîä
input int MA1_Period = 5; // ïåðèîä óñðåäíåíèÿ
input int MA1_Shift = 0; // ñìåùåíèå èíäèêàòîðà ïî ãîðèçîíòàëè
input ENUM_MA_METHOD MA1_Method = MODE_LWMA; // òèï ñãëàæèâàíèÿ
input ENUM_APPLIED_PRICE MA1_Applied_Price = PRICE_CLOSE; // òèï öåíû èëè handle
input string MA2_Info="Ïàðàìåòðû Moving Average 2";
input ENUM_TIMEFRAMES MA2_TFPeriod = 0; // ïåðèîä
input int MA2_Period = 12; // ïåðèîä óñðåäíåíèÿ
input int MA2_Shift = 0; // ñìåùåíèå èíäèêàòîðà ïî ãîðèçîíòàëè
input ENUM_MA_METHOD MA2_Method = MODE_LWMA; // òèï ñãëàæèâàíèÿ
input ENUM_APPLIED_PRICE MA2_Applied_Price = PRICE_CLOSE; // òèï öåíû èëè handle
input string MA3_Info="Ïàðàìåòðû Moving Average 3";
input ENUM_TIMEFRAMES MA3_TFPeriod = 0; // ïåðèîä
input int MA3_Period = 18; // ïåðèîä óñðåäíåíèÿ
input int MA3_Shift = 0; // ñìåùåíèå èíäèêàòîðà ïî ãîðèçîíòàëè
input ENUM_MA_METHOD MA3_Method = MODE_EMA; // òèï ñãëàæèâàíèÿ
input ENUM_APPLIED_PRICE MA3_Applied_Price = PRICE_CLOSE; // òèï öåíû èëè handle
input string MA4_Info="Ïàðàìåòðû Moving Average 4";
input ENUM_TIMEFRAMES MA4_TFPeriod = 0; // ïåðèîä
input int MA4_Period = 28; // ïåðèîä óñðåäíåíèÿ
input int MA4_Shift = 0; // ñìåùåíèå èíäèêàòîðà ïî ãîðèçîíòàëè
input ENUM_MA_METHOD MA4_Method = MODE_EMA; // òèï ñãëàæèâàíèÿ
input ENUM_APPLIED_PRICE MA4_Applied_Price = PRICE_CLOSE; // òèï öåíû èëè handle
input string MA5_Info="Ïàðàìåòðû Moving Average 5";
input ENUM_TIMEFRAMES MA5_TFPeriod = 0; // ïåðèîä
input int MA5_Period = 50; // ïåðèîä óñðåäíåíèÿ
input int MA5_Shift = 0; // ñìåùåíèå èíäèêàòîðà ïî ãîðèçîíòàëè
input ENUM_MA_METHOD MA5_Method = MODE_SMA; // òèï ñãëàæèâàíèÿ
input ENUM_APPLIED_PRICE MA5_Applied_Price = PRICE_CLOSE; // òèï öåíû èëè handle
Buffers of the Several Moving Average Indicator For MT4
The Several Moving Average Indicator For MT4 provides 5 buffers.
SetIndexBuffer(0,MA1Buffer);
SetIndexBuffer(1,MA2Buffer);
SetIndexBuffer(2,MA3Buffer);
SetIndexBuffer(3,MA4Buffer);
SetIndexBuffer(4,MA5Buffer);
Main Parts Of The Code
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int limit=rates_total-prev_calculated;
//---
for(int i=0; i lt limit; i++)
{
if(MA1_Period!=0)
MA1Buffer[i]=iMA(NULL,MA1_TFPeriod,MA1_Period,MA1_Shift,MA1_Method,MA1_Applied_Price,i);
if(MA2_Period!=0)
MA2Buffer[i]=iMA(NULL,MA2_TFPeriod,MA2_Period,MA2_Shift,MA2_Method,MA2_Applied_Price,i);
if(MA3_Period!=0)
MA3Buffer[i]=iMA(NULL,MA3_TFPeriod,MA3_Period,MA3_Shift,MA3_Method,MA3_Applied_Price,i);
if(MA4_Period!=0)
MA4Buffer[i]=iMA(NULL,MA4_TFPeriod,MA4_Period,MA4_Shift,MA4_Method,MA4_Applied_Price,i);
if(MA5_Period!=0)
MA5Buffer[i]=iMA(NULL,MA5_TFPeriod,MA5_Period,MA5_Shift,MA5_Method,MA5_Applied_Price,i);
}
return(rates_total);
}
//+------------------------------------------------------------------+