EURX - Finally, having found the calculation for the Euro Index - here it is - indicator for MetaTrader 4




EURX - Finally, having found the calculation for the Euro Index - here it is - indicator for MetaTrader 4


Real author:

Andy Thompson

Description:

In 2009 I published the indicator for DXY - Dollar Index - it was well received and downloaded many times in English and Russian. Now having found the definition of the Euro Index I submit this for the communitys use and comment.

 

The definition can be found at Forex Ltd 


EURX


//+------------------------------------------------------------------+
//|                                                   Euro Index.mq4 |
//|                                  Copyright © 2015, Andy Thompson |
//|                                   mailto:[email protected] |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2015, Andy Thompson"
#property link      "mailto:[email protected]"
#property strict
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_width1 2
#property indicator_color2 Yellow
#property indicator_width2 1
#property indicator_style2 1
#property indicator_color3 Lime
#property indicator_width3 1
#property indicator_style3 2
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
int i;
extern int short_term_SMA_period=20;
extern int long_term_SMA_period =40;
//int winind;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexLabel(0,"DXY");
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexLabel(1,short_term_SMA_period+"SMA");
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexLabel(2,long_term_SMA_period+"SMA");
   IndicatorShortName("Euro Index: EURX / "+short_term_SMA_period+"SMA / "+long_term_SMA_period+"SMA");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   if(counted_bars < 0)  return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit-=1+long_term_SMA_period;
//---- main loop
   for(i=0; i<limit; i++)
     {
      ExtMapBuffer1[i]= 34.38805726*MathPow(iClose("EURUSD",0,i),0.3155)*MathPow(iClose("EURJPY",0,i),0.1891)*MathPow(iClose("EURGBP",0,i),0.3056)*MathPow(iClose("EURSEK",0,i),0.0785)*MathPow(iClose("EURCHF",0,i),0.1113);

     }
   for(i=0; i<limit; i++)
     {
      ExtMapBuffer2[i]=0;
      ExtMapBuffer3[i]=0;
      for(int z=0; z<long_term_SMA_period; z++)
        {
         if(z<short_term_SMA_period) ExtMapBuffer2[i]=ExtMapBuffer2[i]+ExtMapBuffer1[i+z];
         ExtMapBuffer3[i]=ExtMapBuffer3[i]+ExtMapBuffer1[i+z];
        }
      ExtMapBuffer2[i] = ExtMapBuffer2[i]/short_term_SMA_period;
      ExtMapBuffer3[i] = ExtMapBuffer3[i]/long_term_SMA_period;
     }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

 


Recommendations:

  • The periods for the moving averages can be changed - defaults are 20 and 40
  • The indicator will work on any chart and on any period


Download EURX - Finally, having found the calculation for the Euro Index - here it is - indicator for MetaTrader 4




Related News




Latest News
'Howdy, Modi!': Thousands, plus Trump, rally in Texas for India's leader
23.09.2019 11:09
(This September 22 story corrects to add dropped word in fourth paragraph.) By Brad Brooks and Steve Holland HOUSTON (Reuters) - U.S. President Donald Trump and Indian Prime Minister Narendra Modi shared a stage and showered each other with praise on Sunday at a "Howdy, Modi!" rally attended by upward of 50,000 people, a rare mass showing for a
Read more
Huawei CFO's arrest at airport to be focus of Vancouver hearing
23.09.2019 11:06
By Karen Freifeld VANCOUVER (Reuters) - Lawyers for Huawei Chief Financial Officer Meng Wanzhou will be in a Canadian courtroom on Monday to press for details surrounding her arrest at Vancouver's airport nearly 10 months ago. Meng, 47, was detained on Dec. 1 at the request of the United States, where she is charged with bank fraud and
Read more
Trump’s Fed Tweets Shown to Have ‘Significant’ Effect on Trading
23.09.2019 11:03
(Bloomberg) -- Terms of Trade is a daily newsletter that untangles a world embroiled in trade wars. Sign up here.  President Donald Trump’s Twitter attacks on the Federal Reserve are prompting investors to bet the central bank will bow to political pressure and lower interest rates, according to a new study. Trump has frequently used social media
Read more
StockBeat: PMIs, Thomas Cook, Oil Cast a Pall Over European Stocks
23.09.2019 10:24
Investing.com -- Summer’s over for European stocks, it seems. The benchmark Stoxx 600 fell to its lowest in five days on Monday after another bleak round of business surveys from the euro zone’s biggest economies suggested no end to the current slowdown. Germany's DAX led losses with a 1.5% drop, while the Italian FTSE MIB was down
Read more
Thomas Cook collapses: Why and what happens now?
23.09.2019 10:21
By Kate Holton and Guy Faulconbridge LONDON (Reuters) - Thomas Cook (L:TCG), the world's oldest travel firm, collapsed on Monday, stranding hundreds of thousands of holidaymakers around the globe and sparking the largest peacetime repatriation effort in British history. What happens now and why did it collapse? WHO IS AFFECTED? The firm ran
Read more