Here's this indicator, it used to work, and now it's not refreshing (MT4 Build 840) 
Maybe some kind soul could take a look at it please!
Maybe some kind soul could take a look at it please!
Inserted Code
//+------------------------------------------------------------------+
//| OtherChart.mq4 |
//| Copyright © 2008, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "jax1000"
#property link "http://www.onix-trade.net/forum/index.php?showtopic=107&view=findpost&p=383010"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 MediumBlue
#property indicator_color2 LimeGreen
#property indicator_color3 Crimson
#property indicator_color4 SaddleBrown
#property indicator_color5 Yellow
#property indicator_color6 DeepPink
#property indicator_color7 BlueViolet
#property indicator_color8 Turquoise
extern bool all_idx_mode=true;//Режим позволяет выбрать-отображать движение всех восьми индексов кластера (положение true) или отображать только два буфера-с индексами только базовой валюты и валюты котировки (положение false).
extern int period=8;//период средней по паре
extern int period1=8;//период "быстрой" скользящей по индексу
extern int period2=24;//период "медленной" скользящей по индексу
extern int MA_Method=0;//метод сглаживания скользящих по паре и индексам. По умолчанию-простое скользящее среднее.
extern int Price=0;//цена для расчета скользящих по паре и индексам. По умолчанию-цена закрытия.
extern int shift=0;//сдвиг скользящих по паре и индексам.
extern int width=3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
double Buffer1[],Buffer2[],Buffer3[],Buffer4[],Buffer5[],Buffer6[],Buffer7[],Buffer8[];
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//определение базовой и котируемой валюты, составляющих валютную пару.
string s=Symbol();
string k=StringSubstr(Symbol(), 3, 3);//определение базовой валюты
string b=StringSubstr(Symbol(), 0, 3);//определение котируемой валюты
string buffer1_name;
string buffer2_name;
if(all_idx_mode==false){buffer1_name=b;buffer2_name=k;}else{buffer1_name="EUR";buffer2_name="USD";}
//автоматическое определение цвета при отключении all_idx_mode
color color1;
color color2;
if(all_idx_mode==false)
{if(b=="EUR") {color1=MediumBlue;}else
if(b=="USD") {color1=LimeGreen;}else
if(b=="GBP") {color1=Crimson;}else
if(b=="CHF") {color1=SaddleBrown;}else
if(b=="CAD") {color1=DeepPink;}else
if(b=="AUD") {color1=BlueViolet;}else
if(b=="NZD") {color1=Turquoise;}
if(k=="JPY") {color2=Yellow;}else
if(k=="USD") {color2=LimeGreen;}else
if(k=="GBP") {color2=Crimson;}else
if(k=="CHF") {color2=SaddleBrown;}else
if(k=="CAD") {color2=DeepPink;}else
if(k=="AUD") {color2=BlueViolet;}else
if(k=="NZD") {color2=Turquoise;}
}else
{color1=MediumBlue;
color2=LimeGreen;
}
IndicatorDigits(Digits);
SetIndexStyle(0,DRAW_LINE,0,width,color1);
SetIndexBuffer(0,Buffer1);
SetIndexStyle(1,DRAW_LINE,0,width,color2);
SetIndexBuffer(1,Buffer2);
SetIndexStyle(2,DRAW_LINE,0,width);
SetIndexBuffer(2,Buffer3);
SetIndexStyle(3,DRAW_LINE,0,width);
SetIndexBuffer(3,Buffer4);
SetIndexStyle(4,DRAW_LINE,0,width);
SetIndexBuffer(4,Buffer5);
SetIndexStyle(5,DRAW_LINE,0,width);
SetIndexBuffer(5,Buffer6);
SetIndexStyle(6,DRAW_LINE,0,width);
SetIndexBuffer(6,Buffer7);
SetIndexStyle(7,DRAW_LINE,0,width);
SetIndexBuffer(7,Buffer8);
SetIndexLabel(0,buffer1_name);
SetIndexLabel(1,buffer2_name);
SetIndexLabel(2,"GBP");
SetIndexLabel(3,"CHF");
SetIndexLabel(4,"JPY");
SetIndexLabel(5,"CAD");
SetIndexLabel(6,"AUD");
SetIndexLabel(7,"NZD");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i;
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i=0; i<limit; i++)
{
datetime BarTime = Time[i];
//синхронизация расчетов по времени
int shiftEUR = iBarShift("EURUSD", 0, BarTime);
int shiftGBP = iBarShift("GBPUSD", 0, BarTime);
int shiftCHF = iBarShift("USDCHF", 0, BarTime);
int shiftJPY = iBarShift("USDJPY", 0, BarTime);
int shiftCAD = iBarShift("USDCAD", 0, BarTime);
int shiftAUD = iBarShift("AUDUSD", 0, BarTime);
int shiftNZD = iBarShift("NZDUSD", 0, BarTime);
//расчет средней от индексов с меньшим периодом.
double usd1=MathPow(Ma("USDCHF",0,period1,shift,MA_Method,Price,shiftCHF)*Ma("USDJPY",0,period1,shift,MA_Method,Price,shiftJPY)*Ma("USDCAD",0,period1,shift,MA_Method,Price,shiftCAD)/Ma("EURUSD",0,period1,shift,MA_Method,Price,shiftEUR)/Ma("GBPUSD",0,period1,shift,MA_Method,Price,shiftGBP)/Ma("AUDUSD",0,period1,shift,MA_Method,Price,shiftAUD)/Ma("NZDUSD",0,period1,shift,MA_Method,Price,shiftNZD),1./8.);
double eur1=Ma("EURUSD",0,period1,shift,MA_Method,Price,shiftEUR)*usd1;
double gbp1=Ma("GBPUSD",0,period1,shift,MA_Method,Price,shiftGBP)*usd1;
double chf1=usd1/Ma("USDCHF",0,period1,shift,MA_Method,Price,shiftCHF);
double idxjpy1=(Ma("USDJPY",0,period1,shift,MA_Method,Price,shiftJPY))/usd1;
double cad1=usd1/Ma("USDCAD",0,period1,shift,MA_Method,Price,shiftCAD);
double aud1=Ma("AUDUSD",0,period1,shift,MA_Method,Price,shiftAUD)*usd1;
double nzd1=Ma("NZDUSD",0,period1,shift,MA_Method,Price,shiftNZD)*usd1;
//расчет средней от индексов с большим периодом.
double usd2=MathPow(Ma("USDCHF",0,period2,shift,MA_Method,Price,shiftCHF)*Ma("USDJPY",0,period2,shift,MA_Method,Price,shiftJPY)*Ma("USDCAD",0,period2,shift,MA_Method,Price,shiftCAD)/Ma("EURUSD",0,period2,shift,MA_Method,Price,shiftEUR)/Ma("GBPUSD",0,period2,shift,MA_Method,Price,shiftGBP)/Ma("AUDUSD",0,period2,shift,MA_Method,Price,shiftAUD)/Ma("NZDUSD",0,period2,shift,MA_Method,Price,shiftNZD),1./8.);
double eur2=Ma("EURUSD",0,period2,shift,MA_Method,Price,shiftEUR)*usd2;
double gbp2=Ma("GBPUSD",0,period2,shift,MA_Method,Price,shiftGBP)*usd2;
double chf2=usd2/Ma("USDCHF",0,period2,shift,MA_Method,Price,shiftCHF);
double idxjpy2=(Ma("USDJPY",0,period2,shift,MA_Method,Price,shiftJPY))/usd2;
double cad2=usd2/Ma("USDCAD",0,period2,shift,MA_Method,Price,shiftCAD);
double aud2=Ma("AUDUSD",0,period2,shift,MA_Method,Price,shiftAUD)*usd2;
double nzd2=Ma("NZDUSD",0,period2,shift,MA_Method,Price,shiftNZD)*usd2;
//расчет отклонения "быстрой" средней от "медленной", по каждому из индексов. (Выделение заданной частоты)
double usdp=usd1-usd2;
double eurp=eur1-eur2;
double gbpp=gbp1-gbp2;
double chfp=chf1-chf2;
double idxjpyp=idxjpy1-idxjpy2;
double cadp=cad1-cad2;
double audp=aud1-aud2;
double nzdp=nzd1-nzd2;
string s=Symbol();
string k=StringSubstr(Symbol(), 3, 3);//определение котируемой валюты
string b=StringSubstr(Symbol(), 0, 3);//определение базовой валюты
//определение индексов, которые формируют валютную пару и присвоение переменным значений выделенных частот этих индексов.
double ch1, ch2;
if(b=="USD"){ch1=usdp;}
if(b=="EUR"){ch1=eurp;} if(k=="USD"){ch2=usdp;}
if(b=="GBP"){ch1=gbpp;} if(k=="GBP"){ch2=gbpp;}
if(b=="CHF"){ch1=chfp;} if(k=="CHF"){ch2=chfp;}
if(k=="JPY"){ch2=idxjpyp;}
if(b=="CAD"){ch1=cadp;} if(k=="CAD"){ch2=cadp;}
if(b=="NZD"){ch1=nzdp;} if(k=="AUD"){ch2=audp;}
if(b=="AUD"){ch1=audp;} if(k=="NZD"){ch2=nzdp;}
//определение индексов, которые формируют валютную пару; расчет скользящей по паре, с заданным периодом; сдвиг скользящих по паре, на величины частот индексов базовой и котируемой валюты.
if(all_idx_mode){//отображать движение всех восьми индексов кластера
if(k=="JPY")//если k равно "JPY"
{
Buffer1[i]=Ma(s,0,period,shift,MA_Method,Price,i)+eurp*100;
Buffer2[i]=Ma(s,0,period,shift,MA_Method,Price,i)+usdp*100;
Buffer3[i]=Ma(s,0,period,shift,MA_Method,Price,i)+gbpp*100;
Buffer4[i]=Ma(s,0,period,shift,MA_Method,Price,i)+chfp*100;
Buffer5[i]=Ma(s,0,period,shift,MA_Method,Price,i)-idxjpyp;
Buffer6[i]=Ma(s,0,period,shift,MA_Method,Price,i)+cadp*100;
Buffer7[i]=Ma(s,0,period,shift,MA_Method,Price,i)+audp*100;
Buffer8[i]=Ma(s,0,period,shift,MA_Method,Price,i)+nzdp*100;
}
else
{
Buffer1[i]=Ma(s,0,period,shift,MA_Method,Price,i)+eurp;
Buffer2[i]=Ma(s,0,period,shift,MA_Method,Price,i)+usdp;
Buffer3[i]=Ma(s,0,period,shift,MA_Method,Price,i)+gbpp;
Buffer4[i]=Ma(s,0,period,shift,MA_Method,Price,i)+chfp;
Buffer5[i]=Ma(s,0,period,shift,MA_Method,Price,i)-idxjpyp/100;
Buffer6[i]=Ma(s,0,period,shift,MA_Method,Price,i)+cadp;
Buffer7[i]=Ma(s,0,period,shift,MA_Method,Price,i)+audp;
Buffer8[i]=Ma(s,0,period,shift,MA_Method,Price,i)+nzdp;
}
}
else //отображать только два буфера-с индексами только базовой валюты и валюты котировки
{if(k=="JPY")
{
Buffer1[i]=Ma(s,0,period,shift,MA_Method,Price,i)+ch1*100;
Buffer2[i]=Ma(s,0,period,shift,MA_Method,Price,i)-ch2;
}
else
{
Buffer1[i]=Ma(s,0,period,shift,MA_Method,Price,i)+ch1;
Buffer2[i]=Ma(s,0,period,shift,MA_Method,Price,i)+ch2;
}}
}
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//функция расчета скользящей средней
double Ma(string valuta, int frame, int period, int shift, int MA_Method, int Price, int z)
{
double res1=0;
res1=iMA(valuta,frame,period,shift,MA_Method,Price,z);
return(res1);
} Attached File(s)