Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 715 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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