'Max' undeclared identifier

Posted By: hola123

'Max' undeclared identifier - 04/18/20 12:46

Hi,

I'm trying to get to grips with coding in Zorro. The problem I have at the moment is very simple however I can't see what I am missing.

So I am just trying to create a simple indicator purely for learning to code. So in my run function I make a call to my indicator which was written above my run function. When I go to run it I get a complier error saying 'Max' undeclared identifier. I also tried putting my indicator in the indicator.c file but same thing.

Am I missing an 'include' statement in my code? One other strange thing is that it says the error is on line 8, line 8 is a comment // blah blah, the Max function call is on line 7. Does this indicate I haven't complied something? Any help much appreciated!
Posted By: danatrader

Re: 'Max' undeclared identifier - 04/19/20 07:44

Post your code.

If you refer to

min(int x, int y): int
min(var x, var y): var
max(int x, int y): int
max(var x, var y): var

they are case sensitive, you write "Max".


line 8, line 8 is a comment -->> you didn't set your parentheses right
Posted By: hola123

Re: 'Max' undeclared identifier - 04/19/20 19:03

Thanks for replying.

By making max lowercase it does indeed solve my problem. What I do not understand is that I was copying code from indicators.c and in the function called Moment it has the line below.


Period = Max(2,Period);

I actually copied that line over. So why is it upper case in indicators.c? Is this something to do with an include statement that is importing other functions?
Posted By: danatrader

Re: 'Max' undeclared identifier - 04/19/20 19:22

just go with it...
Posted By: AndrewAMD

Re: 'Max' undeclared identifier - 04/19/20 19:22

I believe Indicators.c was never intended to be used in a Zorro script, but rather, as part of Zorro's backend. Thus, there will be some functions, global variables, and macros that are not defined when you try to use it with Zorro.
Posted By: hola123

Re: 'Max' undeclared identifier - 04/19/20 21:02

Ok thanks to both of you for your help
© 2024 lite-C Forums