Gamestudio Links
Zorro Links
Newest Posts
history data for spy not work ?
by faustf. 06/09/23 20:29
Exact time of previous bar of higher timeframe
by AndrewAMD. 06/09/23 15:50
Enter Long Tomorrow at Open + Offset
by Groundhog. 06/09/23 08:50
server auto shutdown kill trades
by andy_trade. 06/08/23 08:52
New Zorro version 2.56
by phs. 06/07/23 20:16
simple question about if long is open
by faustf. 06/06/23 22:00
How to buy tomorrow at open?
by frutza. 06/06/23 02:26
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (Grant, faustf, AndrewAMD), 960 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Vkvishal, Mishiwaka, frutza, BInnacle, androsa
18945 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: 2
J
JMMAC Offline OP
Guest
JMMAC  Offline OP
Guest
J

Joined: May 2023
Posts: 2
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,650
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

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