//+------------------------------------------------------------------+ //| 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=clrNONE; color color2=clrNONE;; 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--; int barsGBPUSD = iBars("GBPUSD",0); int barsUSDCHF = iBars("USDCHF",0); int barsUSDJPY = iBars("USDJPY",0); int barsUSDCAD = iBars("USDCAD",0); int barsEURUSD = iBars("EURUSD",0); int barsAUDUSD = iBars("AUDUSD",0); int barsNZDUSD = iBars("NZDUSD",0); int temp = MathMin(barsGBPUSD,MathMin(barsUSDCHF,MathMin(barsUSDJPY,MathMin(barsUSDCAD,MathMin(barsEURUSD,MathMin(barsAUDUSD,barsNZDUSD)))))); if(temp>0) limit = temp-counted_bars; else { Print("Not enough history for used symbols."); return(0); } limit=Bars-counted_bars; if(counted_bars==0) limit-=(period2+1); for(i=0; i