Gamestudio Links
Zorro Links
Newest Posts
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:48
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 (ozgur, TipmyPip), 722 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
AssetFloat not work? #483182
05/08/21 09:41
05/08/21 09:41
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Be carefull, with the version Zorro not work
Zorro S 2.37.4b
(c) oP group Germany 2021


Code
function run()
{
    asset("EUR/USD");
    AssetFloat[0]=1234.56;
    printf("\n%s = %f",Asset,AssetFloat[0]);
    quit("ok!");
}


have output:
Code

testIN compiling...........
EUR/USD = 0.000000
Test: testIN EUR/USD 2016..2021
Assets Assets4

ok!


Re: AssetFloat not work? [Re: Grat] #483183
05/08/21 09:47
05/08/21 09:47
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Other problem - must be know

Code

function run()
{

    asset("EUR/USD");
    AssetVar[0]=33.99;
    printf("\n%s = %f",Asset,AssetVar[0]);
    AssetFloat[0]=1234.56;
    printf("\n%s = %f",Asset,AssetVar[0]);
    quit("ok!");
}



have this output:
Code

testIN compiling...........
EUR/USD = 33.990002
EUR/USD = 33.989998
Test: testIN EUR/USD 2016..2021
Assets Assets4

ok!



This is correct - from manual:
32 general purpose int or float variables for internally storing integers or floats specific to the current asset. They are shared with AssetVar/AssetStr at twice the index, i.e. AssetVar[N] is shared with AssetInt[2*N] and AssetInt[2*N+1]. They cannot be read from the asset list. AssetInt can also be used to store asset-specific series or pointers for using them in a tmf or tick function.

Last edited by Grat; 05/08/21 09:53.
Re: AssetFloat not work? [Re: Grat] #483186
05/08/21 13:51
05/08/21 13:51
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
You need to cast float to var in order for printf to work.

Yes, var(double) is double the width of float. This has implications for pointer arithmetic / array positions.

You can read var and strings up to seven characters in length in your asset list for AssetVar and AssetStr, respectively.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1