#property description "Index USD" #property indicator_separate_window #property indicator_buffers 7 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 clrGray #property indicator_width1 1 #property indicator_label1 "Index USD" double b_USD[]; double b_EURUSD[]; double b_GBPUSD[]; double b_USDJPY[]; double b_USDCHF[]; double b_USDCAD[]; double b_USDSEK[]; int limit1; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //Setting indicator buffers SetIndexBuffer(0,b_USD,INDICATOR_DATA); SetIndexBuffer(1,b_EURUSD,INDICATOR_CALCULATIONS); SetIndexBuffer(2,b_GBPUSD,INDICATOR_CALCULATIONS); SetIndexBuffer(3,b_USDJPY,INDICATOR_CALCULATIONS); SetIndexBuffer(4,b_USDCHF,INDICATOR_CALCULATIONS); SetIndexBuffer(5,b_USDCAD,INDICATOR_CALCULATIONS); SetIndexBuffer(6,b_USDSEK,INDICATOR_CALCULATIONS); //Additional indicator settings IndicatorSetString(INDICATOR_SHORTNAME,"Index USD"); IndicatorSetInteger(INDICATOR_DIGITS,_Digits); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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 i,from; static int rates_total_prev=0; //Calculating auxillary values from=rates_total_prev-1; if (from<0) from=0; if (CopyOpen("EURUSD",_Period,0,rates_total-rates_total_prev+1,b_EURUSD)<=0 || CopyOpen("GBPUSD",_Period,0,rates_total-rates_total_prev+1,b_GBPUSD)<=0 || CopyOpen("USDJPY",_Period,0,rates_total-rates_total_prev+1,b_USDJPY)<=0 || CopyOpen("USDCHF",_Period,0,rates_total-rates_total_prev+1,b_USDCHF)<=0 || CopyOpen("USDCAD",_Period,0,rates_total-rates_total_prev+1,b_USDCAD)<=0 || CopyOpen("USDSEK",_Period,0,rates_total-rates_total_prev+1,b_USDSEK)<=0) return(0); //The main cycle of calculations for (i=from;i