Gamestudio Links
Zorro Links
Newest Posts
Camera always moves upwards?
by clonman. 11/13/25 14:04
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
Training with the R bridge does not work
by frutza. 11/05/25 00:46
Zorro 2.70
by opm. 10/24/25 03:44
Alpaca Plugin v1.4.0
by TipmyPip. 10/20/25 18:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Grant, AndrewAMD, ozgur, Quad, TipmyPip), 29,980 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sheliepaley, Blueguy, blobplayintennis, someone2, NotEBspark
19177 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,809
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,809
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: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
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: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
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: 28,029
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,029
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: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

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


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1