This is a litte indicator I wrote to always have the current value of the USD Index.
You need a broker that provides the following currency pairs:
PHP Code
//+------------------------------------------------------------------+ //| USD Index.mq4 | //| Copyright © 2008, Adam Parusel | //| http://esolvix.de | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, Adam Parusel" #property link "http://esolvix.de" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Lime #property indicator_level1 82.0 //---- buffers double ExtMapBuffer1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- the last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- main loop for(int i=0; i<limit; i++) { double eurusd = iClose("EURUSD",0,i); double usdjpy = iClose("USDJPY",0,i); double gbpusd = iClose("GBPUSD",0,i); double usdcad = iClose("USDCAD",0,i); double usdsek = iClose("USDSEK",0,i); double usdchf = iClose("USDCHF",0,i); ExtMapBuffer1[i] = 50.14348112 * MathPow(eurusd,-0.576) * MathPow(usdjpy,0.136) * MathPow(gbpusd,-0.119) * MathPow(usdcad,0.091) * MathPow(usdsek,0.042) * MathPow(usdchf,0.036); } return(0); }
- EURUSD
- USDJPY
- GBPUSD
- USDCAD
- USDSEK
- USDCHF
Any comments welcome.