Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
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
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, rki), 390 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
create string array? #483146
05/06/21 06:46
05/06/21 06:46
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
Hi,

how to create the string or char array?

string aSymbol[12]={"EUR/USD","USD/JPY","EUR/JPY","AUD/USD","NZD/USD","AUD/NZD","USD/CAD","GBP/USD","EUR/GBP","GBP/JPY","AUD/JPY","EUR/CAD"};

have


omegaData compiling............
Error in 'line 15:
syntax error
< string aSymbol[12]={"EUR/USD","USD/JPY","EUR/JPY","AUD/USD","NZD/USD","AUD/NZD","USD/CAD","GBP/USD","EUR/GBP","GBP/JPY","AUD/JPY","EUR/CAD"};
>.

Re: create string array? [Re: Grat] #483158
05/06/21 13:40
05/06/21 13:40
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
First, you declare the array, no initialization.

Then, from 0 thru 11, you assign a string to each.

Like:
string aSymbol[12];
aSymbol[0]="EUR/USD"; // and so on

Re: create string array? [Re: Grat] #483164
05/06/21 15:58
05/06/21 15:58
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
Variation 1
Code
STRING* asymbol[12];
str_cpy(asymbol[0], "EUR/USD";
str_cpy(asymbol[1], "USD/JPY";
str_cpy(asymbol[2], "AUD/USD";
... and so on...

Variation 2
Code
TEXT* asymbol = {
     strings =  ("EUR/USD","USD/JPY","EUR/JPY","AUD/USD","NZD/USD","AUD/NZD","USD/CAD","GBP/USD","EUR/GBP","GBP/JPY","AUD/JPY","EUR/CAD");
}

I'm not sure the syntax is totally OK, I wrote it without any editor, help or so.

Last edited by Aku_Aku; 05/06/21 16:00. Reason: maybe the syntax will be better
Re: create string array? [Re: Grat] #483166
05/06/21 16:34
05/06/21 16:34
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
my solution:
Code
#define SYMBOLS "EUR/USD","USD/JPY","EUR/JPY","AUD/USD","NZD/USD","AUD/NZD","USD/CAD","GBP/USD","EUR/GBP","GBP/JPY","AUD/JPY","EUR/CAD"
string aSymbol[12];
...
...
if (is(FIRSTINITRUN)){
   while(asset(loop(SYMBOLS))){
         aSymbol[i]=Asset;
   }
}

Re: create string array? [Re: Grat] #483173
05/07/21 07:24
05/07/21 07:24
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
If it works, something really new must be implemented in GS.
Or is it a Zorro feature?

Last edited by Aku_Aku; 05/07/21 07:26.
Re: create string array? [Re: Grat] #483198
05/10/21 10:11
05/10/21 10:11
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Variants 1 and 2 are wrong. The variant by Grat is correct syntax, but the loop function is normally for portfolio optimization, not for array filling. Andrew's version is correct.

Re: create string array? [Re: jcl] #483201
05/10/21 15:07
05/10/21 15:07
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
Yeah, Zorro is different.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1