Gamestudio Links
Zorro Links
Newest Posts
Help with Data import to T1
by AndrewAMD
45 minutes 48 seconds ago
Using ":L" & ":S" causes 2 possible bug(s) or is it bad coding?
by AndrewAMD
Today at 03:54
Correlation -1.#IND00
by AndrewAMD
01/21/19 17:37
Basic thread safety question
by Superku
01/20/19 18:15
Blog Post: Get Historical Data from Darwinex REST API w/ Zorro
by AndrewAMD
01/19/19 22:19
Reseting a static variable - the next day
by OptimusPrime
01/19/19 19:48
Train algorithms separatery
by 3dgamelight
01/18/19 10:37
AUM Magazine
Latest Screens
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Who's Online
12 registered (Iglarion, AndrewAMD, Michael_Schwarz, ags, chsmac85, kvm, ibne, alibaba, 3 invisible), 431 Guests and 6 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
laz, ramonne, SibJac, Evael, NRW
18156 Registered Users
Topic Options
Rate This Topic
#470944 - 02/13/18 21:07 AssetVars in Asset Lists
Sphin Offline
User

Registered: 12/11/13
Posts: 567
Loc: Fuerth, DE
From the manual AssetVars can be entered in the asset list behind the Symbol column but how to access them? Let me say an asset list looks like:
Code:
..., Commission, Symbol, TOCom
..., 0, BTC/USD, 0.0026


Do I find the value 0.0026 automatically in AssetVar[0] independent from the column's name "TOCom" (so it's better not to use AssetVar[0] otherwise in the script) or is there another way?

Thanks, Sphin

Top
#470945 - 02/14/18 03:17 Re: AssetVars in Asset Lists [Re: Sphin]
Hredot Offline
Member

Registered: 09/11/17
Posts: 235
Hi Sphin,

Once you call

asset(Assets[i]);

where i=0,1,2,3,... labels the assets in the AssetList.csv that you loaded, AssetVar[0] will refer to your TOCom value in the i-th row.
Yes, the row with the names does not interfere with the values. The first row (i==0) refers to the first actual asset row in your list.


Edited by Hredot (02/14/18 03:20)

Top
#471034 - 02/16/18 18:09 Re: AssetVars in Asset Lists [Re: Hredot]
Sphin Offline
User

Registered: 12/11/13
Posts: 567
Loc: Fuerth, DE
Thanks. You mean if I call asset("BTCUSD") than AssetVar[0] has the value from the column TOCom of the row beginning with "BTCUSD" from the loaded asset list? Then I understood. laugh

Top
#471036 - 02/16/18 18:16 Re: AssetVars in Asset Lists [Re: Sphin]
Hredot Offline
Member

Registered: 09/11/17
Posts: 235
Yep, exactly!
At least, that is how it worked in the DualMomentum code I played around with.
I don't know if you actually want to hard code "BTCUSD" string or similar though... Code might be more powerful if you access the different assets by using "Assets[i]". Then you can switch out the asset list and test the system on different ones without changing any lines in the code. laugh Like, if tomorrow you decide to trade a different crypto than BTC for example.


Edited by Hredot (02/16/18 18:20)

Top
#471055 - 02/17/18 19:13 Re: AssetVars in Asset Lists [Re: Hredot]
Sphin Offline
User

Registered: 12/11/13
Posts: 567
Loc: Fuerth, DE
This I think about as a maybe last step of optimizing in a completed code. But during development I like more using names of assets because pointing at them through an array means to add a potential point of failure in - and I know myself - choosing the wrong one and later wondering about issues.

Top
#471061 - 02/18/18 02:50 Re: AssetVars in Asset Lists [Re: Sphin]
Hredot Offline
Member

Registered: 09/11/17
Posts: 235
I see, yeah, makes sense!

Top



Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de