4554

 

5454

 
LibertySilver:

...

Forum on trading, automated trading systems and testing trading strategies


Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.


 

Many errors at compile time

'(' - unbalanced right parenthesis test_indicator.mq4
'(' - unbalanced right parenthesis test_indicator.mq4
'(' - unbalanced right parenthesis test_indicator.mq4
'(' - unbalanced right parenthesis test_indicator.mq4
'(' - unbalanced right parenthesis test_indicator.mq4
'(' - unbalanced right parenthesis test_indicator.mq4
'(' - unbalanced right parenthesis test_indicator.mq4
'(' - unbalanced right parenthesis test_indicator.mq4

 

Now we need to correct the mistakes:

'(' - unbalanced right parenthesis

 
LibertySilver:
how would i fix array out of range 
First you need to fix the problems. With the error code does not compile.
 
1
 
//+------------------------------------------------------------------+
//| HighLow_Custom.mq4 |
//+------------------------------------------------------------------+
#property strict
#property link  ""
#property copyright ""
#property version "1.0" 
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Yellow
#property indicator_color3 Blue
//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

string Time_Frame_value="0,M1,M5,M15,M30,H1,H4,D1,W1,MN1";
string Time_Frame="0";

int timeFrame;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
  {

   if(Time_Frame=="M1")
     {

      timeFrame=PERIOD_M1;

        } else if(Time_Frame=="M5") {

      timeFrame=PERIOD_M5;

        } else if(Time_Frame=="M15") {

      timeFrame=PERIOD_M15;

        } else if(Time_Frame=="M30") {

      timeFrame=PERIOD_M30;

        } else if(Time_Frame=="H1") {

      timeFrame=PERIOD_H1;

        } else if(Time_Frame=="H4") {

      timeFrame=PERIOD_H4;

        } else if(Time_Frame=="D1") {

      timeFrame=PERIOD_D1;

        } else if(Time_Frame=="W1") {

      timeFrame=PERIOD_W1;

        } else if(Time_Frame=="MN1") {

      timeFrame=PERIOD_MN1;

        } else {

      timeFrame=0;

     }
/*
   if (timeFrame < Period()) {

      Alert("The timeframe must be higher than the current");
      deinit();

   }
*/
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(2,DRAW_LINE);

   return(0);

  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectsDeleteAll();
   Comment("");
   return(0);

  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
  {

/*
// Check for expiration date//   
string expire_date = "2014.09.08"; //<-- hard coded datetime
datetime e_d = StrToTime(expire_date); 

if (TimeCurrent( )  >= e_d)
   {
     Alert ("EA EXPIRED....TO PURCHASE PLEASE EMAIL ");
     return(0);
   }
*/

   int shift,i,CurDay=-1,BarCount=-1;
   double DayMax=-1.0,DayMin=-1.0;
   double DayOpen;
   double yesterday_close,yesterday_high,yesterday_low,NH,NL;

   for(shift=Bars-1; shift>=0; shift--)
     {

      int timeFrameIndex=iBarShift(NULL,timeFrame,Time[shift],true);

      if(CurDay!=iTime(NULL,timeFrame,timeFrameIndex+1))
        {

         for(i=BarCount; i>=0; i--)
           {

            ExtMapBuffer1[shift+i] = DayMax;
            ExtMapBuffer2[shift+i] = (DayMax+DayMin)/2;
            ExtMapBuffer3[shift+i] = DayMin;

           }

         CurDay=iTime(NULL,timeFrame,timeFrameIndex);
         BarCount=0;
         // DayMax = 0;
         // DayMin = 1000;
         DayOpen=Open[shift];

        }

      yesterday_close= iClose(Symbol(),timeFrame,shift+1);
      yesterday_high = iHigh(Symbol(),timeFrame,shift+1);
      yesterday_low=iLow(Symbol(),timeFrame,shift+1);

      NH=(((yesterday_high+yesterday_low+yesterday_close)/3)*2)-yesterday_low;

      NL=(((yesterday_high+yesterday_low+yesterday_close)/3)*2)-yesterday_high;

      //   if (DayMax < High[shift]) {

      DayMax=(((yesterday_high+yesterday_low+yesterday_close)/3)*2)-yesterday_low;

      //  }

      //  if (DayMin > Low[shift]) {

      DayMin=(((yesterday_high+yesterday_low+yesterday_close)/3)*2)-yesterday_high;

      //  }

      BarCount=BarCount+1;
     }

   for(i=BarCount; i>=0; i--)
     {

      ExtMapBuffer1[shift+i] = DayMax;
      ExtMapBuffer2[shift+i] = (DayMax+DayMin)/2;
      ExtMapBuffer3[shift+i] = DayMin;

     }

//  DayClose = Close[0];
// Avg = (DayMax+DayMin)/2;
//drawLabel(DoubleToStr(NL,Digits),NL,White);
//drawLabel(DoubleToStr(NH,Digits),NH,White);
   return(0);

  }
//+------------------------------------------------------------------+ 
void drawLabel(string name,double lvl,color Color)
  {
   if(ObjectFind(name)!=0)
     {

      ObjectCreate(name,OBJ_TEXT,0,Time[0],lvl);
      ObjectSetText(name,name,8,"Arial",EMPTY);
      ObjectSet(name,OBJPROP_COLOR,Color);
      ObjectMove(name,0,Time[0],lvl);
     }
   else
     {
      ObjectMove(name,0,Time[0],lvl);
     }
  }
//+------------------------------------------------------------------+

 

Here is the error. You need to convert the type datetime:

CurDay=iTime(NULL,timeFrame,timeFrameIndex); 
 
LibertySilver:

5454

Why did you remove your code ?

People are investing their free time to answer you.

 
And what happened to the code?
Reason: