Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 905 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Return type of floor() #487517
05/25/23 13:45
05/25/23 13:45
Joined: May 2023
Posts: 5
J
JMMAC Offline OP
Newbie
JMMAC  Offline OP
Newbie
J

Joined: May 2023
Posts: 5
Hi,
I'm at the start of my learning curve with Zorro and I have a couple of questions.


1) The Zorro manual says floor() returns a var/double but then gives an example where it returns an int.

int a = floor(b);

This obviously doesn't work and "a" will be 0 or have the wrong value. I guess it's an error in the manual.

But this leads to another question, why do floor(), ceil() and round() return doubles and not ints?

In my Zorro code I'm using "Lots" to enter my position size which I believe is an int. So should I use something like:

Lots = (int)round(...); ?


2) When I print to the log file, to have the output well formatted, it seems I have to put a \n at the beginning of the string and not at the end as one would expect when printing to a terminal:

print(TO_LOG,"\nLotAmmount = %f", LotAmount);

Is there a reason for that?

Thank you,
Jaime.

Re: Return type of floor() [Re: JMMAC] #487520
05/25/23 14:17
05/25/23 14:17
Joined: Feb 2017
Posts: 1,726
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,726
Chicago
1) Double casts to int, so it's not wrong, so long as you don't need floating point values.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1