Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/20/24 06:09
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (flink, Edgar_Herrera), 695 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
'Max' undeclared identifier #479691
04/18/20 12:46
04/18/20 12:46
Joined: Mar 2020
Posts: 19
London
H
hola123 Offline OP
Newbie
hola123  Offline OP
Newbie
H

Joined: Mar 2020
Posts: 19
London
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!

Re: 'Max' undeclared identifier [Re: hola123] #479706
04/19/20 07:44
04/19/20 07:44
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
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

Last edited by danatrader; 04/19/20 07:58.
Re: 'Max' undeclared identifier [Re: danatrader] #479711
04/19/20 19:03
04/19/20 19:03
Joined: Mar 2020
Posts: 19
London
H
hola123 Offline OP
Newbie
hola123  Offline OP
Newbie
H

Joined: Mar 2020
Posts: 19
London
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?

Re: 'Max' undeclared identifier [Re: hola123] #479712
04/19/20 19:22
04/19/20 19:22
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
just go with it...

Re: 'Max' undeclared identifier [Re: hola123] #479713
04/19/20 19:22
04/19/20 19:22
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
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.

Re: 'Max' undeclared identifier [Re: hola123] #479715
04/19/20 21:02
04/19/20 21:02
Joined: Mar 2020
Posts: 19
London
H
hola123 Offline OP
Newbie
hola123  Offline OP
Newbie
H

Joined: Mar 2020
Posts: 19
London
Ok thanks to both of you for your help


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1