Metatrader indicator conversion to cAlgo

Created at 02 Feb 2020
jani's avatar

jani

Joined 05.04.2019

Status

Open


Budget

100.00 EUR


Payment Method

Direct Payment

Job Description

I have this pretty nice and usefull market internals type of indicator in MQL. Indicator read multiple pairs and shows the price data of  a basket of EUR-cross currencies in relation to the current chart currencies. Indicator also counts an average of the all pairs calculated to show the overall Euro-basket trend.

 

This MQL code goes a bit beyond my own c#/cAlgo capabilities as a programmer, so I would like to have some help from someone more skilful in C#/cAlgo.

 

A short 3-minute intro video about the indicator below:

MQ4 file download here:

 

MQL code below:

#property indicator_chart_window
#property indicator_buffers 8

#property indicator_color1 Yellow
#property indicator_color2 OrangeRed
#property indicator_color3 PaleGreen
#property indicator_color4 Aqua
#property indicator_color5 ForestGreen
#property indicator_color6 Tan
#property indicator_color7 White
#property indicator_color8 Pink

#property indicator_width7 3
//---- buffers

extern   int      line_centre=100;  
extern   bool ShowEurUsd=true;     
extern   int      dir_EurUsd=1; 
extern   bool ShowEurGbp=true;
extern   int      dir_EurGbp=1;
extern   bool ShowEurChf=true;
extern   int      dir_EurChf=1;
extern   bool ShowEurJpy=true;
extern   int      dir_EurJpy=1;
extern   bool ShowEurAud=false;
extern   int      dir_EurAud=1;
extern   bool ShowEurCad=false;
extern   int      dir_EurCad=1;
extern   bool ShowEurNzd=false;
extern   int      dir_EurNzd=1;
extern string        History_Info=" *** How long back to draw  ***";
extern int Draw4HowLong=0; 
extern string        Average_Info1=" *** Show  average line  ***";
extern bool            ShowAverage=true;
extern string        Average_Info2=" *** Show only average line  ***";
extern bool        ShowAverageOnly=false;
extern string    EuroAverage_Info1=" *** Calculate Euro in average line ***";
extern bool Calculate_NZD_CAD_AUD_InAverage=false;
extern string       LineWidth_Info=" *** Set graph line width  ***";
extern   int             LineWidth=0;
extern   int      AverageLineWidth=3;
extern string       CheckData_Info=" *** Check history data integrity  ***";
extern bool    CheckDownloadedData=false;
extern int     LookBackHistoryData=3000;
extern int           AlertTreshold=10;
//---- Info Box
extern string InfoBox=" *** Info Box Parameters ***";
 bool         ShowAdditional=true;
extern int          corner=4;
extern int          topOff=380;
color        labelColor=Gray;
color        clockColor=White;
extern bool         showExtra=false;

//---- 

extern color EurUsdColor=Yellow;
extern color EurGbpColor=OrangeRed;
extern color EurChfColor=PaleGreen;
extern color EurAudColor=Aqua;
extern color EurCadColor=ForestGreen;
extern color EurNzdColor=Tan;
extern color EurJpyColor=Pink;
extern color AverageColor=White;

int   ia,ib,ic,id,ie=0;
int   cnt1,cnt2,temp0,temp1=0;
int ii=2;
bool Alert1=false,Alert2=false,Alert3=false,Alert4=false,Alert5=false,Alert6=false;
int alertcount1,alertcount2,alertcount3,alertcount4,alertcount5,alertcount6,alertcount7;

double   centre_EurUsd,centre_EurAud,centre_EurGbp,centre_EurCad,centre_EurChf,centre_EurNzd,centre_EurJpy;
double   centre_curent;

//-------
double Average, Average2,CurrencyLine;
string Time_;
int pair;
double pt,mt;
static int count_;
//-------

double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];

double EurUsd[],EurAud[],EurGbp[],EurCad[],EurChf[],EurNzd[],EurJpy[];

int    counted_bars;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  
   if(Digits==3 || Digits==5){pt=Point*10; mt=10; }else{pt=Point; mt=1;}

   Time_=TimeToStr(TimeCurrent(),TIME_DATE|TIME_MINUTES);

   if(Draw4HowLong==0)Draw4HowLong=Bars-20;

 //============ Check Downloaded data integrity ====================== 
  if(CheckDownloadedData){
 /*
 for   ( ii=2;ii<1000;ii++) {if( !Alert1 && iTime("EURUSD", 0, ii)/(Period()*60)-  iTime("EURUSD", 0, (ii+1))/(Period()*60)!=1){ Alert1=true; Alert (WindowExpertName()+" Data  EURUSD error, TF: "+Period()+"  Cycle Run#: "+ii);}} 
 for   ( ii=2;ii<1000;ii++) {if( !Alert2 && iTime("EURGBP", 0, ii)/(Period()*60)-  iTime("EURGBP", 0, (ii+1))/(Period()*60)!=1){ Alert2=true;Alert (WindowExpertName()+" Data  EURGBP error, TF: "+Period()+"  Cycle Run#: "+ii);}}
 for   ( ii=2;ii<1000;ii++) {if( !Alert3 && iTime("EURCHF", 0, ii)/(Period()*60)-  iTime("EURCHF", 0, (ii+1))/(Period()*60)!=1){ Alert3=true;Alert (WindowExpertName()+" Data  EURCHF error, TF: "+Period()+"  Cycle Run#: "+ii);}}
 for   ( ii=2;ii<1000;ii++) {if( !Alert4 && iTime("EURAUD", 0, ii)/(Period()*60)-  iTime("EURAUD", 0, (ii+1))/(Period()*60)!=1){ Alert4=true;Alert (WindowExpertName()+" Data  EURAUD error, TF: "+Period()+"  Cycle Run#: "+ii);}}
 for   ( ii=2;ii<1000;ii++) {if( !Alert4 && iTime("EURJPY", 0, ii)/(Period()*60)-  iTime("EURJPY", 0, (ii+1))/(Period()*60)!=1){ Alert4=true;Alert (WindowExpertName()+" Data  EURJPY error, TF: "+Period()+"  Cycle Run#: "+ii);}}
 
  for   ( ii=2;ii<1000;ii++) {if( !Alert6 && iTime("EURNZD", 0, ii)/(Period()*60)-  iTime("EURNZD", 0, (ii+1))/(Period()*60)!=1){ Alert6=true;Alert (WindowExpertName()+" Data  EURNZD error, TF: "+Period()+"  Cycle Run#: "+ii);}}
 for   ( ii=2;ii<1000;ii++) {if( !Alert5 && iTime("EURCAD", 0, ii)/(Period()*60)-  iTime("EURCAD", 0, (ii+1))/(Period()*60)!=1){ Alert5=true;Alert (WindowExpertName()+" Data  EURCAD error, TF: "+Period()+"  Cycle Run#: "+ii);}}
*/
 /*
 for   ( ii=2;ii<100;ii++) {if(iTime("EURUSD", 0, ii)/(Period()*60)-  iTime("EURUSD", 0, (ii+1))/(Period()*60)!=1){Alert (WindowExpertName()+" Data  EURUSD error, TF: "+Period()+"  Cycle Run#: "+ii);}} 
 for   ( ii=2;ii<100;ii++) {if(iTime("EURGBP", 0, ii)/(Period()*60)-  iTime("EURGBP", 0, (ii+1))/(Period()*60)!=1){Alert (WindowExpertName()+" Data  EURGBP error, TF: "+Period()+"  Cycle Run#: "+ii);}}
 for   ( ii=2;ii<100;ii++) {if(iTime("EURCHF", 0, ii)/(Period()*60)-  iTime("EURCHF", 0, (ii+1))/(Period()*60)!=1){Alert (WindowExpertName()+" Data  EURCHF error, TF: "+Period()+"  Cycle Run#: "+ii);}}
 
 for   ( ii=2;ii<100;ii++) {if(iTime("EURAUD", 0, ii)/(Period()*60)-  iTime("EURAUD", 0, (ii+1))/(Period()*60)!=1){Alert (WindowExpertName()+" Data  EURAUD error, TF: "+Period()+"  Cycle Run#: "+ii);}}
 for   ( ii=2;ii<100;ii++) {if(iTime("EURNZD", 0, ii)/(Period()*60)-  iTime("EURNZD", 0, (ii+1))/(Period()*60)!=1){Alert (WindowExpertName()+" Data  EURNZD error, TF: "+Period()+"  Cycle Run#: "+ii);}}
 for   ( ii=2;ii<100;ii++) {if(iTime("EURCAD", 0, ii)/(Period()*60)-  iTime("EURCAD", 0, (ii+1))/(Period()*60)!=1){Alert (WindowExpertName()+" Data  EURCAD error, TF: "+Period()+"  Cycle Run#: "+ii);}}
*/
  
  
  for   ( ii=2;ii<LookBackHistoryData;ii++) {
  

  
if(iTime("EURUSD", 0, ii)/(Period()*60)-  iTime("EURUSD", 0, (ii+1))/(Period()*60)!=1)alertcount1++;
if (alertcount1>AlertTreshold){ Alert (WindowExpertName()+" Data  EURUSD error, TF: "+Period()+"  Run#: "+ii+" Alert count: "+alertcount1); alertcount1=0;} 

if(iTime("EURGBP", 0, ii)/(Period()*60)-  iTime("EURGBP", 0, (ii+1))/(Period()*60)!=1)alertcount2++;
if (alertcount2>AlertTreshold){Alert (WindowExpertName()+" Data  EURGBP error, TF: "+Period()+"  Run#: "+ii+" Alert count: "+alertcount2);}

if(iTime("EURCHF", 0, ii)/(Period()*60)-  iTime("EURCHF", 0, (ii+1))/(Period()*60)!=1)alertcount3++;
if (alertcount3>AlertTreshold){Alert (WindowExpertName()+" Data  EURCHF error, TF: "+Period()+"  Run#: "+ii+" Alert count: "+alertcount3);}

if(iTime("EURAUD", 0, ii)/(Period()*60)-  iTime("EURAUD", 0, (ii+1))/(Period()*60)!=1)alertcount4++;
if (alertcount4>AlertTreshold){Alert (WindowExpertName()+" Data  EURAUD error, TF: "+Period()+"  Run#: "+ii+" Alert count: "+alertcount4);}

if(iTime("EURNZD", 0, ii)/(Period()*60)-  iTime("EURNZD", 0, (ii+1))/(Period()*60)!=1)alertcount5++;
if (alertcount5>AlertTreshold){Alert (WindowExpertName()+" Data  EURNZD error, TF: "+Period()+"  Run#: "+ii+" Alert count: "+alertcount5);}

if(iTime("EURCAD", 0, ii)/(Period()*60)-  iTime("EURCAD", 0, (ii+1))/(Period()*60)!=1)alertcount6++;
if (alertcount6>AlertTreshold){Alert (WindowExpertName()+" Data  EURCAD error, TF: "+Period()+"  Run#: "+ii+" Alert count: "+alertcount6);}
  
if(iTime("EURJPY", 0, ii)/(Period()*60)-  iTime("EURJPY", 0, (ii+1))/(Period()*60)!=1)alertcount7++;
if (alertcount7>AlertTreshold){Alert (WindowExpertName()+" Data  EURJPY error, TF: "+Period()+"  Run#: "+ii+" Alert count: "+alertcount7);} 
  
  
  }
  
   
  }
 
  //============  
  
  
  
  //---- Info Box
 int Y1=60;
 int left = 40;

   ObjectMakeLabel( "Label1", left+60, 0+ Y1, EurUsdColor );
   ObjectMakeLabel( "Value1", left,    0+ Y1, EurUsdColor );
   ObjectMakeLabel( "Label2", left+60, 15+Y1, EurGbpColor );
   ObjectMakeLabel( "Value2", left,    15+Y1, EurGbpColor );
   ObjectMakeLabel( "Label3", left+60, 30+Y1, EurChfColor );
   ObjectMakeLabel( "Value3", left,    30+Y1, EurChfColor );
   ObjectMakeLabel( "Label8", left+60, 45+Y1, EurJpyColor );
   ObjectMakeLabel( "Value8", left,    45+Y1, EurJpyColor );
 if(!Calculate_NZD_CAD_AUD_InAverage)  {  
   ObjectMakeLabel( "Label7", left+60, 60+Y1, AverageColor);
   ObjectMakeLabel( "Value7", left,    60+Y1, AverageColor);
   }
  
 if(Calculate_NZD_CAD_AUD_InAverage)  {
   ObjectMakeLabel( "Label4", left+60, 60+Y1,  EurAudColor );
   ObjectMakeLabel( "Value4", left,    60+Y1,  EurAudColor );
   ObjectMakeLabel( "Label5", left+60, 75+Y1,  EurCadColor );
   ObjectMakeLabel( "Value5", left,    75+Y1,  EurCadColor );
   ObjectMakeLabel( "Label6", left+60, 90+Y1,  EurNzdColor );
   ObjectMakeLabel( "Value6", left,    90+Y1,  EurNzdColor );
   ObjectMakeLabel( "Label7", left+60, 105+Y1, AverageColor);
   ObjectMakeLabel( "Value7", left,    105+Y1, AverageColor);
   }


//---- indicators
   SetIndexStyle(0,DRAW_LINE,EMPTY,LineWidth,EurUsdColor); // else SetIndexStyle(0,DRAW_NONE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE,EMPTY,LineWidth,EurGbpColor);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE,EMPTY,LineWidth,EurChfColor);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE,EMPTY,LineWidth,EurAudColor);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_LINE,EMPTY,LineWidth,EurCadColor);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_LINE,EMPTY,LineWidth,EurNzdColor);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexStyle(6,DRAW_LINE,EMPTY,AverageLineWidth,AverageColor);
   SetIndexBuffer(6,ExtMapBuffer7);
   SetIndexStyle(7,DRAW_LINE,EMPTY,LineWidth,EurJpyColor);
   SetIndexBuffer(7,ExtMapBuffer8);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   ObjectDelete("EurUsd");
   ObjectDelete("EurGbp");
   ObjectDelete("EurChf");
   ObjectDelete("EurAud");
   ObjectDelete("EurCad");
   ObjectDelete("EurNzd"); 
   ObjectDelete("EurJpy"); 
   ObjectDelete("Avearge"); 

   ObjectDelete( "Label5" );
   ObjectDelete( "Value5" );
   ObjectDelete( "Label2" );
   ObjectDelete( "Value2" );
   ObjectDelete( "Label1" );
   ObjectDelete( "Value1" );
   ObjectDelete( "Label3" );
   ObjectDelete( "Value3" );
   ObjectDelete( "Label4" );
   ObjectDelete( "Value4" );
   ObjectDelete( "Label6" );
   ObjectDelete( "Value6" );
   ObjectDelete( "Label7" );
   ObjectDelete( "Value7" ); 
   ObjectDelete( "Label8" );
   ObjectDelete( "Value8" );
   ObjectDelete( "LabelX" );
   ObjectDelete( "ValueX" );

 /*   */  
   Comment(" ");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  
  Time_=TimeToStr(TimeCurrent(),TIME_DATE|TIME_MINUTES);
  
  
   // Choose value for ArrayCopySeries 
//if(LookBackHistoryData!=0)counted_bars=MathMin(IndicatorCounted(),LookBackHistoryData); else counted_bars=IndicatorCounted();

  counted_bars=IndicatorCounted(); //Above replaces this original
//---- 
//if       ( count_==0 || count_ < iBarShift(NULL,0,1)-0 )  { 
   ArrayCopySeries(EurUsd,MODE_CLOSE,"EURUSD",Period());
   ArrayCopySeries(EurGbp,MODE_CLOSE,"EURGBP",Period());
   ArrayCopySeries(EurChf,MODE_CLOSE,"EURCHF",Period());
   ArrayCopySeries(EurAud,MODE_CLOSE,"EURAUD",Period());
   ArrayCopySeries(EurCad,MODE_CLOSE,"EURCAD",Period());
   ArrayCopySeries(EurNzd,MODE_CLOSE,"EURNZD",Period());
   ArrayCopySeries(EurJpy,MODE_CLOSE,"EURJPY",Period());
   //
   temp0=iBars(Symbol(),0)-20;
   int
    iUSD=iBarShift("EURUSD",0,iTime(Symbol(),0,0)),
    iGBP=iBarShift("EURGBP",0,iTime(Symbol(),0,0)),
    iCHF=iBarShift("EURCHF",0,iTime(Symbol(),0,0)),
    iAUD=iBarShift("EURAUD",0,iTime(Symbol(),0,0)),
    iCAD=iBarShift("EURCAD",0,iTime(Symbol(),0,0)),
    iNZD=iBarShift("EURNZD",0,iTime(Symbol(),0,0)),
    iJPY=iBarShift("EURJPY",0,iTime(Symbol(),0,0));
 
   if (ArraySize(EurUsd)<temp0+1)  temp0=(ArraySize(EurUsd)-1)-iUSD;//Alert(WindowExpertName()+" EurUsd "+Period()+" ArraySize:"+ArraySize(EurUsd));}
   if (ArraySize(EurGbp)<temp0+1)  temp0=(ArraySize(EurGbp)-1)-iGBP;//Alert(WindowExpertName()+" EurGbp "+Period()+" ArraySize:"+ArraySize(EurGbp));}
   if (ArraySize(EurChf)<temp0+1)  temp0=(ArraySize(EurChf)-1)-iCHF;//Alert(WindowExpertName()+" EurChf "+Period()+" ArraySize:"+ArraySize(EurChf)+" new tepm0:"+temp0);}
   if (ArraySize(EurAud)<temp0+1)  temp0=(ArraySize(EurAud)-1)-iAUD;//Alert(WindowExpertName()+" EurAud "+Period()+" ArraySize:"+ArraySize(EurAud));}
   if (ArraySize(EurCad)<temp0+1)  temp0=(ArraySize(EurCad)-1)-iCAD;//Alert(WindowExpertName()+" EurCad "+Period()+" ArraySize:"+ArraySize(EurCad));}
   if (ArraySize(EurNzd)<temp0+1)  temp0=(ArraySize(EurNzd)-1)-iNZD;//Alert(WindowExpertName()+" EurNzd "+Period()+" ArraySize:"+ArraySize(EurNzd));}
   if (ArraySize(EurJpy)<temp0+1)  temp0=(ArraySize(EurJpy)-1)-iJPY;//Alert(WindowExpertName()+" EurJpy "+Period()+" ArraySize:"+ArraySize(EurJpy));}
//count_ = iBarShift(NULL,0,1); }   
  
 
         
   //
   if (line_centre>=temp0) {   Comment(" Comment for line_centre>=temp0... ");   return(0);   }

   
 if (temp0-line_centre<iBars(Symbol(),0)-counted_bars)  temp1=MathMin((Draw4HowLong-(line_centre)),(temp0-line_centre)); //Alert("Indicator: "+ WindowExpertName()+" temp0-line_centre<Bars-counted_bars !!!"); }
  else    temp1=iBars(Symbol(),0)-counted_bars;

 
   for   (ia=temp1;ia>=0;ia--) {
   //
      centre_EurUsd=0;
      centre_EurGbp=0;
      centre_EurChf=0;
      centre_EurAud=0;
      centre_EurCad=0;
      centre_EurNzd=0;
      centre_EurJpy=0;
      centre_curent=0;
      for   (ic=line_centre-1;ic>=0;ic--) {
         centre_EurUsd=centre_EurUsd+EurUsd[(ia+ic)+iUSD]; 
         centre_EurGbp=centre_EurGbp+EurGbp[(ia+ic)+iGBP]; 
         centre_EurChf=centre_EurChf+EurChf[(ia+ic)+iCHF]; 
         centre_EurAud=centre_EurAud+EurAud[(ia+ic)+iAUD]; 
         centre_EurCad=centre_EurCad+EurCad[(ia+ic)+iCAD]; 
         centre_EurNzd=centre_EurNzd+EurNzd[(ia+ic)+iNZD]; 
         centre_EurJpy=centre_EurJpy+EurJpy[(ia+ic)+iJPY]; 
         centre_curent=centre_curent+iClose(Symbol(),0,ia+ic); 
      }
      centre_EurUsd=centre_EurUsd/line_centre;
      centre_EurGbp=centre_EurGbp/line_centre;
      centre_EurChf=centre_EurChf/line_centre;
      centre_EurAud=centre_EurAud/line_centre;
      centre_EurCad=centre_EurCad/line_centre;
      centre_EurNzd=centre_EurNzd/line_centre;
      centre_EurJpy=centre_EurJpy/line_centre;
      centre_curent=centre_curent/line_centre;
   //
   
   
//==========================   
 if       ( count_==0 || count_ < iBarShift(NULL,0,0)-0 )  {   
if(centre_EurUsd==0) info(0);
//if(centre_EurUsd==0) Alert( doing("")+" >>>>> centre_EurUsd is 0");
  if(centre_EurGbp==0) Alert( " >>>>> centre_EurGbp is 0");
   if(centre_EurChf==0) Alert( " >>>>> centre_EurChf is 0");
    if(centre_EurAud==0) Alert( " >>>>> centre_EurAud is 0");
     if(centre_EurCad==0) Alert( " >>>>> centre_EurCad is 0");
      if(centre_EurNzd==0) Alert( " >>>>> centre_EurNzd is 0");
       if(centre_EurJpy==0) Alert( " >>>>> centre_EurJpy is 0");
        if(centre_curent==0) Alert( " >>>>> centre_curent is 0");
  
 if(EurUsd[(ia+ic)+iUSD]==0){ info("EU is 0");}
  if(EurGbp[(ia+ic)+iGBP]==0){ info("EG is 0");}
   if(EurChf[(ia+ic)+iCHF]==0){ info("ECh is 0");}
    if(EurAud[(ia+ic)+iAUD]==0){ info("EA is 0");}
     if(EurCad[(ia+ic)+iCAD]==0){ info("ECa is 0");}
      if(EurNzd[(ia+ic)+iNZD]==0){ info("EN is 0");}
       if(EurJpy[(ia+ic)+iJPY]==0){ info("EY is 0");}
        if(iClose(Symbol(),0,ia+ic)==0){ info(" Bar(0)is 0"); } 
        
count_ = iBarShift(NULL,0,0); 
  
   }    
                
 //==========================    

  if(ShowEurUsd && !ShowAverageOnly) { 
   ExtMapBuffer1[ia]=
   (dir_EurUsd*EurUsd[ia+iUSD]+(1-dir_EurUsd)/EurUsd[ia+iUSD])*centre_curent/(dir_EurUsd*centre_EurUsd+(1-dir_EurUsd)/centre_EurUsd);
    } else ExtMapBuffer1[ia]=0;
   
   if(ShowEurGbp && !ShowAverageOnly) { 
   ExtMapBuffer2[ia]=
   (dir_EurGbp*EurGbp[ia+iGBP]+(1-dir_EurGbp)/EurGbp[ia+iGBP])*centre_curent/(dir_EurGbp*centre_EurGbp+(1-dir_EurGbp)/centre_EurGbp);
  } else ExtMapBuffer2[ia]=0;
  
   if(ShowEurChf && !ShowAverageOnly) { 
   ExtMapBuffer3[ia]=
   (dir_EurChf*EurChf[ia+iCHF]+(1-dir_EurChf)/EurChf[ia+iCHF])*centre_curent/(dir_EurChf*centre_EurChf+(1-dir_EurChf)/centre_EurChf);
  } else ExtMapBuffer3[ia]=0;
  
   if(ShowEurAud && !ShowAverageOnly) { 
   ExtMapBuffer4[ia]=
   (dir_EurAud*EurAud[ia+iAUD]+(1-dir_EurAud)/EurAud[ia+iAUD])*centre_curent/(dir_EurAud*centre_EurAud+(1-dir_EurAud)/centre_EurAud);
  } else ExtMapBuffer4[ia]=0;
  
   if(ShowEurCad && !ShowAverageOnly) { 
   ExtMapBuffer5[ia]=
   (dir_EurCad*EurCad[ia+iCAD]+(1-dir_EurCad)/EurCad[ia+iCAD])*centre_curent/(dir_EurCad*centre_EurCad+(1-dir_EurCad)/centre_EurCad);
  } else ExtMapBuffer5[ia]=0;
  
   if(ShowEurNzd && !ShowAverageOnly) { 
   ExtMapBuffer6[ia]=
   (dir_EurNzd*EurNzd[ia+iNZD]+(1-dir_EurNzd)/EurNzd[ia+iNZD])*centre_curent/(dir_EurNzd*centre_EurNzd+(1-dir_EurNzd)/centre_EurNzd);
  } else ExtMapBuffer6[ia]=0;
   
   if(ShowEurJpy && !ShowAverageOnly) { 
   ExtMapBuffer8[ia]=
   (dir_EurJpy*EurJpy[ia+iJPY]+(1-dir_EurJpy)/EurJpy[ia+iJPY])*centre_curent/(dir_EurJpy*centre_EurJpy+(1-dir_EurJpy)/centre_EurJpy);
  } else ExtMapBuffer8[ia]=0;
   
   
   
   //Average
      Average=((
            (EurUsd[ia+iUSD]*centre_curent/centre_EurUsd)
          + (EurChf[ia+iCHF]*centre_curent/centre_EurChf)
          + (EurJpy[ia+iJPY]*centre_curent/centre_EurJpy)
          + (EurGbp[ia+iGBP]*centre_curent/centre_EurGbp)
             )/4); 
   /*
     Average=(((dir_EurUsd*EurUsd[ia]+(1-dir_EurUsd)/EurUsd[ia])*centre_curent/(dir_EurUsd*centre_EurUsd+(1-dir_EurUsd)/centre_EurUsd)
    + (dir_EurGbp*EurGbp[ia]+(1-dir_EurGbp)/EurGbp[ia])*centre_curent/(dir_EurGbp*centre_EurGbp+(1-dir_EurGbp)/centre_EurGbp)
    + (dir_EurChf*EurChf[ia]+(1-dir_EurChf)/EurChf[ia])*centre_curent/(dir_EurChf*centre_EurChf+(1-dir_EurChf)/centre_EurChf)
    + (dir_EurJpy*EurJpy[ia]+(1-dir_EurJpy)/EurJpy[ia])*centre_curent/(dir_EurJpy*centre_EurJpy+(1-dir_EurJpy)/centre_EurJpy)
    )/4);  
   */
   
    Average2=(((dir_EurUsd*EurUsd[ia+iUSD]+(1-dir_EurUsd)/EurUsd[ia+iUSD])*centre_curent/(dir_EurUsd*centre_EurUsd+(1-dir_EurUsd)/centre_EurUsd)
    + (dir_EurGbp*EurGbp[ia+iGBP]+(1-dir_EurGbp)/EurGbp[ia+iGBP])*centre_curent/(dir_EurGbp*centre_EurGbp+(1-dir_EurGbp)/centre_EurGbp)
    + (dir_EurChf*EurChf[ia+iCHF]+(1-dir_EurChf)/EurChf[ia+iCHF])*centre_curent/(dir_EurChf*centre_EurChf+(1-dir_EurChf)/centre_EurChf)
    + (dir_EurJpy*EurJpy[ia+iJPY]+(1-dir_EurJpy)/EurJpy[ia+iJPY])*centre_curent/(dir_EurJpy*centre_EurJpy+(1-dir_EurJpy)/centre_EurJpy)
    + (dir_EurNzd*EurNzd[ia+iNZD]+(1-dir_EurNzd)/EurNzd[ia+iNZD])*centre_curent/(dir_EurNzd*centre_EurNzd+(1-dir_EurNzd)/centre_EurNzd)
    + (dir_EurAud*EurAud[ia+iAUD]+(1-dir_EurAud)/EurAud[ia+iAUD])*centre_curent/(dir_EurAud*centre_EurAud+(1-dir_EurAud)/centre_EurAud)
    + (dir_EurCad*EurCad[ia+iCAD]+(1-dir_EurCad)/EurCad[ia+iCAD])*centre_curent/(dir_EurCad*centre_EurCad+(1-dir_EurCad)/centre_EurCad)
   )/7);    
   
   if(ShowAverage || ShowAverageOnly) { 
    
      if(Calculate_NZD_CAD_AUD_InAverage==false){
     ExtMapBuffer7[ia]= Average; } 
       else {ExtMapBuffer7[ia]= Average2;}
    
    } else ExtMapBuffer7[ia]=0;

 //===================== count the difference  

//double EurChfToAverage=ExtMapBuffer7[0]-ExtMapBuffer3[0]
/*

Comment("centre_curent "+centre_curent
   +"\n"+"iTime(     EURNZD, 0) "+iTime(     "EURNZD",0, 0)
     +"\n"+"iTime(     EURNZD, 5) "+iTime(     "EURNZD",0, 5)
   +"\n"+"TimeCurrent_  "+TimeCurrent_
   
    +"\n"+"Time[0] "+Time[0]/(Period()*60)
    +"\n"+"Time[0] "+Time[1]/(Period()*60)
     +"\n"+"iTime(EURNZD, 0, 3)/(Period()*60) "+iTime("EURNZD", 0, 3)/(Period()*60)
    +"\n"+"iTime(EURNZD, 0, 4)/(Period()*60) "+iTime("EURNZD", 0, 4)/(Period()*60)
     +"\n"+"(iTime(EURUSD, 0, 1)/(Period()*60) "+ iTime("EURUSD", 0, 1)/(Period()*60)
   );

*/
if ((Bars-counted_bars)==1)   {
   //
   ObjectDelete("EurUsd");
   ObjectCreate("EurUsd",OBJ_TEXT,0,Time[0]+Period()*11*60,ExtMapBuffer1[0]);
   ObjectSet("EurUsd",OBJPROP_COLOR,EurUsdColor);
   ObjectSetText("EurUsd","EurUsd "+DoubleToStr(EurUsd[0],4),8,"arial");
   //
   ObjectDelete("EurGbp");
   ObjectCreate("EurGbp",OBJ_TEXT,0,Time[0]+Period()*11*60,ExtMapBuffer2[0]);
   ObjectSet("EurGbp",OBJPROP_COLOR,EurGbpColor);
   ObjectSetText("EurGbp","EurGbp "+DoubleToStr(EurGbp[0],4),8,"arial");
   //
   ObjectDelete("EurChf");
   ObjectCreate("EurChf",OBJ_TEXT,0,Time[0]+Period()*11*60,ExtMapBuffer3[0]);
   ObjectSet("EurChf",OBJPROP_COLOR,EurChfColor);
   ObjectSetText("EurChf","EurChf "+DoubleToStr(EurChf[0],4),8,"arial");
  
   ObjectDelete("EurJpy");
   ObjectCreate("EurJpy",OBJ_TEXT,0,Time[0]+Period()*11*60,ExtMapBuffer8[0]);
   ObjectSet("EurJpy",OBJPROP_COLOR,EurJpyColor);
   ObjectSetText("EurJpy","EurJpy "+DoubleToStr(EurJpy[0],4),8,"arial");
     
   ObjectDelete("Avearge");
   ObjectCreate("Avearge",OBJ_TEXT,0,Time[0]+Period()*11*60,ExtMapBuffer7[0]);
   ObjectSet("Avearge",OBJPROP_COLOR,AverageColor);
   ObjectSetText("Avearge","Avearge "+DoubleToStr(ExtMapBuffer7[0],4),8,"arial");
  

   ObjectDelete("EurAud");
   ObjectCreate("EurAud",OBJ_TEXT,0,Time[0]+Period()*11*60,ExtMapBuffer4[0]);
   ObjectSet("EurAud",OBJPROP_COLOR,EurAudColor);
   ObjectSetText("EurAud","EurAud "+DoubleToStr(EurAud[0],4),8,"arial");
    //
   ObjectDelete("EurCad");
   ObjectCreate("EurCad",OBJ_TEXT,0,Time[0]+Period()*11*60,ExtMapBuffer5[0]);
   ObjectSet("EurCad",OBJPROP_COLOR,EurCadColor );
   ObjectSetText("EurCad","EurCad "+DoubleToStr(EurCad[0],2),8,"arial");
    //
   ObjectDelete("EurNzd");
   ObjectCreate("EurNzd",OBJ_TEXT,0,Time[0]+Period()*11*60,ExtMapBuffer6[0]);
   ObjectSet("EurNzd",OBJPROP_COLOR,EurNzdColor);
   ObjectSetText("EurNzd","EurNzd "+DoubleToStr(EurNzd[0],4),8,"arial");
   


   
   
   }

///================
 //---- Info Box
  string aaa = DoubleToStr(EurUsd[0],4); // + "  " + Bars+"/"+Ask; 
  string bbb = DoubleToStr(EurGbp[0],4);
  string ccc = DoubleToStr(EurChf[0],4);
  string ddd = DoubleToStr(EurAud[0],4);
  string eee = DoubleToStr(EurCad[0],3);
  string fff = DoubleToStr(EurNzd[0],4);
  string ggg = DoubleToStr(ExtMapBuffer7[0],4);
  string hhh = DoubleToStr(EurJpy[0],4);

   
   ObjectSetText( "Label1", "EurUsd:", 8, "Arial" );
   ObjectSetText( "Value1", aaa, 8, "Arial" );
   ObjectSetText( "Label2", "EurGbp:", 8, "Arial" );
   ObjectSetText( "Value2", bbb, 8, "Arial" );
   ObjectSetText( "Label3", "EurChf:", 8, "Arial" );
   ObjectSetText( "Value3", ccc, 8, "Arial" );   
   ObjectSetText( "Label8", "EurJpy:", 8, "Arial" );
   ObjectSetText( "Value8", hhh, 8, "Arial" );  
   ObjectSetText( "Label7", "Average:", 8, "Arial" );
   ObjectSetText( "Value7", ggg, 8, "Arial" );
   
   ObjectSetText( "Label4", "EurAud:", 8, "Arial" );
   ObjectSetText( "Value4", ddd, 8, "Arial" );
   ObjectSetText( "Label5", "EurCad:", 8, "Arial" );
   ObjectSetText( "Value5", eee, 8, "Arial" );
   ObjectSetText( "Label6", "EurNzd:", 8, "Arial" );
   ObjectSetText( "Value6", fff, 8, "Arial" );

   
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int ObjectMakeLabel( string n, int xoff, int yoff, color Color ) {
   ObjectCreate( n, OBJ_LABEL, 0, 0, 0 );
   ObjectSet( n, OBJPROP_CORNER, corner );
   ObjectSet( n, OBJPROP_XDISTANCE, xoff );
   ObjectSet( n, OBJPROP_YDISTANCE, yoff );
   ObjectSet( n, OBJPROP_BACK, true );
   ObjectSet( n, OBJPROP_COLOR, Color );
}

void doing(string Action_) {
 
 Print(AccountCompany()+" / "+Symbol()+" / "+Period()+" / "+WindowExpertName()+ " is attempting to " + Action_);

}

void info(string info) {

 string time_=TimeToStr(TimeCurrent(),TIME_DATE|TIME_MINUTES);
 
   Alert(info+" >>> "+ AccountCompany()+" / "+Symbol()+" / M"+Period()+" / "+WindowExpertName()+" / Time: "+time_+ "   " );
}

 

 

If you prefer, we can also do the project at Freelancer.

If we do the project here I need to confirm the indicator output before I release funds (you will have to send me closed source code indicator for testing). I can pay in crypto (Dash, BTC ETH etc) or PayPal. : 

I can be contacted at Telegram @Fibonacci2011.

Comments
Log in to add a comment.
4xdev.team's avatar
4xdev.team · 4 years ago

Good day!

This is Oksana from 4xdev!
I can help you with your task. Please let me know if you are interested.
Contact me via 4xdev.team@gmail.com
Looking forward to hearing from you.

AlgoZoneStore's avatar
AlgoZoneStore · 4 years ago

Hi, i can do it.