//---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- int s; //---- if(AccountBalance()!=0) { for(s=0;s<28;s++) { if(MarketInfo(symbol[s],MODE_TRADEALLOWED)==false || iOpen(symbol[s],0,0)==0) { Alert("There is no instrument data for index Multi_MA_V1 ",symbol[s]);return(0); } else if(MarketInfo(symbol[s],MODE_TRADEALLOWED)==true || iOpen(symbol[s],0,0)!=0) { //---- calculation of minimum number of bars (length of the chart displayed) if(BarsMin==0) { Barsi[s]=iBars(symbol[s],0) } BarsMin=Barsi[ArrayMinimum(Barsi)]; } } }
//---- int limit; int counted_bars=IndicatorCounted();
//---- the last counted bar will be counted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; if(limit>BarsMin)limit=BarsMin; //---- main loop double Sum,Sum1; for(int i=0;i<limit;i++) { Sum=0; Sum1=0; for(s=0;s<28;s++) { int bar=iBarShift(symbol[s],0,Time[i]); Sum+=iMA(symbol[s],0,period,0,MODE_SMA,PRICE_CLOSE,bar)/28 ; } CloseBuffer[i]=Sum; } //---- return(0); } //+------------------------------------------------------------------+
//---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- int s; //---- if(AccountBalance()!=0) { for(s=0;s<28;s++) { if(MarketInfo(symbol[s],MODE_TRADEALLOWED)==false || iOpen(symbol[s],0,0)==0) { Alert("There is no instrument data for index Multi_MA_V1 ",symbol[s]);return(0); } else if(MarketInfo(symbol[s],MODE_TRADEALLOWED)==true || iOpen(symbol[s],0,0)!=0) { //---- calculation of minimum number of bars (length of the chart displayed) if(BarsMin==0) { Barsi[s]=iBars(symbol[s],0) } BarsMin=Barsi[ArrayMinimum(Barsi)]; } } }
//---- int limit; int counted_bars=IndicatorCounted();
//---- the last counted bar will be counted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; if(limit>BarsMin)limit=BarsMin; //---- main loop double Sum,Sum1; for(int i=0;i<limit;i++) { Sum=0; Sum1=0; for(s=0;s<28;s++) { int bar=iBarShift(symbol[s],0,Time[i]); Sum+=((iMA(symbol[s],0,period,0,MODE_SMA,PRICE_CLOSE,bar)-iMA(symbol[s],0,period1,0,MODE_SMA,PRICE_CLOSE,bar))-1)/28 ; } CloseBuffer[i]=Sum; } //---- return(0); } //+------------------------------------------------------------------+
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
//+------------------------------------------------------------------+
//| Multi_MA_V1.mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| https://www.metaquotes.net// |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp.
#property link "https://www.metaquotes.net//"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Yellow
//---- input parameters
extern int period=1;
//---- buffers
double CloseBuffer[];
string symbol[28]={
"AUDCAD", "AUDCHF", "AUDJPY", "AUDNZD", "AUDUSD", "CADCHF", "CADJPY", "CHFJPY","EURAUD", "EURCAD", "EURCHF", "EURGBP", "EURJPY", "EURNZD", "EURUSD", "GBPAUD", "GBPCAD",
"GBPCHF", "GBPJPY", "GBPUSD", "NZDCAD", "NZDCHF", "NZDJPY", "NZDUSD", "USDCAD", "USDCHF", "USDJPY", "GBPSGD"};
int Barsi[28],BarsMin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,CloseBuffer);
IndicatorDigits(2);
IndicatorShortName("Multi_MA_V1");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
int s;
//----
if(AccountBalance()!=0)
{
for(s=0;s<28;s++)
{
if(MarketInfo(symbol[s],MODE_TRADEALLOWED)==false || iOpen(symbol[s],0,0)==0)
{
Alert("There is no instrument data for index Multi_MA_V1 ",symbol[s]);return(0);
}
else if(MarketInfo(symbol[s],MODE_TRADEALLOWED)==true || iOpen(symbol[s],0,0)!=0)
{
//---- calculation of minimum number of bars (length of the chart displayed)
if(BarsMin==0)
{
Barsi[s]=iBars(symbol[s],0)
}
BarsMin=Barsi[ArrayMinimum(Barsi)];
}
}
}
//----
int limit;
int counted_bars=IndicatorCounted();
//---- the last counted bar will be counted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
if(limit>BarsMin)limit=BarsMin;
//---- main loop
double Sum,Sum1;
for(int i=0;i<limit;i++)
{
Sum=0;
Sum1=0;
for(s=0;s<28;s++)
{
int bar=iBarShift(symbol[s],0,Time[i]);
Sum+=iMA(symbol[s],0,period,0,MODE_SMA,PRICE_CLOSE,bar)/28 ;
}
CloseBuffer[i]=Sum;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Multi_MA_V2(spred).mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| https://www.metaquotes.net// |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp.
#property link "https://www.metaquotes.net//"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Yellow
//---- input parameters
extern int period=13;
extern inttern period1=21;
//---- buffers
double CloseBuffer[];
string symbol[28]={
"AUDCAD", "AUDCHF", "AUDJPY", "AUDNZD", "AUDUSD", "CADCHF", "CADJPY", "CHFJPY","EURAUD", "EURCAD", "EURCHF", "EURGBP", "EURJPY", "EURNZD", "EURUSD", "GBPAUD", "GBPCAD",
"GBPCHF", "GBPJPY", "GBPUSD", "NZDCAD", "NZDCHF", "NZDJPY", "NZDUSD", "USDCAD", "USDCHF", "USDJPY", "GBPSGD"};
int Barsi[28],BarsMin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,CloseBuffer);
IndicatorDigits(2);
IndicatorShortName("Multi_MA_V1");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
int s;
//----
if(AccountBalance()!=0)
{
for(s=0;s<28;s++)
{
if(MarketInfo(symbol[s],MODE_TRADEALLOWED)==false || iOpen(symbol[s],0,0)==0)
{
Alert("There is no instrument data for index Multi_MA_V1 ",symbol[s]);return(0);
}
else if(MarketInfo(symbol[s],MODE_TRADEALLOWED)==true || iOpen(symbol[s],0,0)!=0)
{
//---- calculation of minimum number of bars (length of the chart displayed)
if(BarsMin==0)
{
Barsi[s]=iBars(symbol[s],0)
}
BarsMin=Barsi[ArrayMinimum(Barsi)];
}
}
}
//----
int limit;
int counted_bars=IndicatorCounted();
//---- the last counted bar will be counted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
if(limit>BarsMin)limit=BarsMin;
//---- main loop
double Sum,Sum1;
for(int i=0;i<limit;i++)
{
Sum=0;
Sum1=0;
for(s=0;s<28;s++)
{
int bar=iBarShift(symbol[s],0,Time[i]);
Sum+=((iMA(symbol[s],0,period,0,MODE_SMA,PRICE_CLOSE,bar)-iMA(symbol[s],0,period1,0,MODE_SMA,PRICE_CLOSE,bar))-1)/28 ;
}
CloseBuffer[i]=Sum;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Don't count it as Up!!!
So, guys, does anybody else have anything to say on the subject?
That leaves hrenfx (I respect him) to read?
https://www.mql5.com/ru/code/10096