Variable Problem

 

Hi, Guys,

when trying to compile my custom indi I get these errors:

'Highest' - variable expected

'Lowest' - variable expected

Have I got something wrong? In my opinion I can't do more than giving a variable a data type and a name and a value...I did all of these 3...why is it not a variable then???

Heres the piece of the code...

int DrawBar(int Beginning, int Ending)
   {
   
   int      Difference=Ending-Beginning;
   double   Openprice=Ending;
   double   Closeprice=Beginning;
   
// these ones cause problems
   double   Highest=iHighest(NULL,0,MODE_HIGH,Difference,Beginning);
   double   Lowest=iLowest(NULL,0,MODE_LOW,Difference,Beginning);

   
      
   ObjectCreate("Bar"+z,OBJ_TREND,1,Time[z],Openprice,Time[z],Closeprice);
   ObjectCreate("Stick"+z,OBJ_TREND,1,Time[z],Highest,Time[z],Lowest);
   ObjectSet("Stick"+z,OBJPROP_COLOR,Gray);
   ObjectSet("Stick"+z,OBJPROP_WIDTH,1);
   
   if(Openprice<Closeprice)
      {
      ObjectSet("Bar"+z,OBJPROP_COLOR,Green);
      ObjectSet("Bar"+z,OBJPROP_WIDTH,4);
      }
   else
      {
      ObjectSet("Bar"+z,OBJPROP_COLOR,Red);
      ObjectSet("Bar"+z,OBJPROP_WIDTH,4);
      }
   
   z++;
   
   return(0);
   }

Would be nice to see some quick response.. ;)

Thanks

EP

 

"In further development of MQL4, some functions were renamed and moved from one group to another in order to systematize them better. The old function names are not highlighted or linked to the MetaEditor Dictionary. The old function names can be used since the compiler will accept them in a proper way. However, we strongly recommend to use the new names."

Highest is the Old Name of iHighest and reserved ...

 
Ahhh, Thanks for that. That's what we need the Experts for...
 
ErrorProgrammer:
Ahhh, Thanks for that. That's what we need the Experts for...

i give you a tip:

to be sure that a name is not used in any programming language, simple use names with a prefix, i.e. "EP_Highest".

EP stands for ErrrorProgrammer in this case ;-)

 
meikel:

i give you a tip:

to be sure that a name is not used in any programming language, simple use names with a prefix, i.e. "EP_Highest".

EP stands for ErrrorProgrammer in this case ;-)

Better programmer practice still - use something that will remind you what type of variable you declared it as.


eg:

dLastKnownPrice which is a double

bTradePermitted which is a bool

iOpenOrders which is an int

sCommentText which is a string


CB

 
cloudbreaker:

Better programmer practice still - use something that will remind you what type of variable you declared it as.


eg:

dLastKnownPrice which is a double

bTradePermitted which is a bool

iOpenOrders which is an int

sCommentText which is a string


CB


yes, but i mostly code in perl or php, and in this languages it doesnt matter.

the type is converted automatic and no declaration is needed before first use of a variable.

only C-Like languages boring me with declarations "what is what" ;-)

ok, if speed is an issue, the type of a variable may be good for better performance and C is the better solution.

the last C i coded was synthesizer-modules for synthedit

 

Yes, yes I use php myself.

But this is MQL.

And its a relatively inexperienced programmer ;-)


CB

Reason: