Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (M_D, AndrewAMD, Quad, Ayumi), 806 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

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