Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 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,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
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: 991
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 991
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: 991
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 991
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,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
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: 991
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

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


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1