Download MetaTrader 5
To add comments, please log in or register
They are making profit already using Freelance service. You can join them!
abdi
193
abdi 2014.09.20 12:50 

hi 

i need some help  because after metrader update  5.00 build 966 my code didn't work 

the code used to sum the volumes of all candles in a specific range

int V=V+ Volume[i];
      ObjectCreate("Volume", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("Volume",DoubleToStr(V,0) ,14, "Arial", Magenta);
      ObjectSet("Volume", OBJPROP_XDISTANCE, 20);
      ObjectSet("Volume", OBJPROP_YDISTANCE, 270);
      ObjectSet("Volume", OBJPROP_CORNER, 1);

  the rest of my code is

int start()

  {
  if(UseAutoDateTime){
  double a=ObjectGet(LineName,OBJPROP_TIME1);
  double b=ObjectGet(LineName,OBJPROP_TIME2);
  StartTime=MathMin(a,b);
  EndTime=MathMax(a,b);
  }
  

 {
   
 
     int shif=iBarShift(Symbol(),0,StartTime,false);
     int shif2=iBarShift(Symbol(),0,EndTime,false);
    }

 
    for(int i=shif2;i<=(shif);i++)



int V=V+ Volume[i];
      ObjectCreate("Volume", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("Volume",DoubleToStr(V,0) ,14, "Arial", Magenta);
      ObjectSet("Volume", OBJPROP_XDISTANCE, 20);
      ObjectSet("Volume", OBJPROP_YDISTANCE, 270);
      ObjectSet("Volume", OBJPROP_CORNER, 1);

 the code was working very will

but after the update of metatrader  the  compiler (meteditor) tell me that

('V' - undeclared identifier )

any help is appreciated  

whroeder1
13596
whroeder1 2014.09.20 13:15  
abdI: ('V' - undeclared identifier )
for(int i=shif2;i<=(shif);i++)
   int V=V+ Volume[i];
  1. V doesn't exist until after the semicolon, so using it in the declaration is undeclared.
  2. Variables are no longer initialized to zero by default.
Don't do either.
int V=0;
for(int i=shif2;i<=(shif);i++)
   V += Volume[i];
Keith Watford
Moderator
7887
Keith Watford 2014.09.20 13:23  
int V=V+ Volume[i];

My Daughter is 5 cm taller this Birthday than she was last Birthday

How tall is she this Birthday? 

Can you answer that? No, of course you can't.

 

Last Birthday my Daughter was 100 cm tall 

My Daughter is 5 cm taller this Birthday than she was last Birthday

How tall is she this Birthday?

Can you answer that? Yes you can. 

abdi
193
abdi 2014.09.20 13:24  

 

 thanks WHRoeder 

i will tray ....thanks again.

 


abdi
193
abdi 2014.09.20 13:29  
GumRai:

My Daughter is 5 cm taller this Birthday than she was last Birthday

How tall is she this Birthday? 

Can you answer that? No, of course you can't.

 

Last Birthday my Daughter was 100 cm tall 

My Daughter is 5 cm taller this Birthday than she was last Birthday

How tall is she this Birthday?

Can you answer that? Yes you can. 

 

 

 

thanks  GumRai:  

this part of my code   (int V=V+ Volume[i];) was given to me by a friend because am not a programmer and  until now am still learning and my background in mql4 don't allow me to fix this problem  ......so am asking......^_^  

thanks for ur replay..... 

 

 

 

whroeder1
13596
whroeder1 2014.09.20 21:37  

abdI: am not a programmer

thanks for ur replay.....

  1. learn to code otherwise there is no common language for us to communicate.
  2. Please don't write ur - it's "you are" or "your" - MQL4 forum
/
To add comments, please log in or register