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 (AndrewAMD, TipmyPip, Edgar_Herrera), 804 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
Saving a string with more than 3 characters in a dataset #482911
04/16/21 09:31
04/16/21 09:31
Joined: Apr 2021
Posts: 14
V
VizTra Offline OP
Newbie
VizTra  Offline OP
Newbie
V

Joined: Apr 2021
Posts: 14
Hello,

I'd like to know, how to save a string in a dataset that is bigger than 3 characters.

What I've got so far:

Quote
dataNew(1, NumAssetsListed, 3);

string tickerString = dataStr(1, 0, 1);
strcpy(tickerString, "AAPL");

dataSet(1, 0, 2, 0.05);
dataSaveCSV(1, "f0,sss,f2,f3", "AppleMomentum.csv");


What I know so far is, that when importing a .csv you can select the format and in that case you can import the csv with a format contain "sss" to import strings bigger than 3 chars. But what about creating completeley new datasets within Zorro?
I create a dataset with dataNew() and then take the pointer to the string field via dataStr(), without being able to somewhere make sure the string can be bigger than 3 characters.

I'm probably missing something.

Kind regards,

Re: Saving a string with more than 3 characters in a dataset [Re: VizTra] #482920
04/16/21 14:51
04/16/21 14:51
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
You can store a string as long as you want, but you need to reserve one more field for any 4 more characters. Those fields then hold a part of the string and cannot contain numbers.

Re: Saving a string with more than 3 characters in a dataset [Re: VizTra] #483590
06/17/21 19:16
06/17/21 19:16
Joined: Jun 2021
Posts: 3
Brazil
D
damasceno Offline
Guest
damasceno  Offline
Guest
D

Joined: Jun 2021
Posts: 3
Brazil
Hi, I'm having a similar difficult.

I can include the string in the dataset but when I export to .csv the first column/row doesn't appear the strings. But if I add the string to another column and row its ok.

Adding to the first column [0]:

Quote

string FormatA = "sss,f,f,f";
function evaluate()
{

dataNew(2, 10, 4);
string statistic = dataStr(2, 0, 0);
strcpy(statistic, "testing");

watch("!i",dataStr(2,0,0));
dataSaveCSV(2,FormatA,"History\\test.csv");



.csv result ->" ,0.00000,0.00000,0.00000,0.00000,0.00000"

changing dataStr to dataStr(2,1,0) -> .csv first line result -> "0.00000,,0.00000,0.00000,0.00000,0.00000"

dataStr(2,1,1) -> .csv second line result -> "0.00000,testing,0.00000,0.00000,0.00000"

Is there a way to add strings to the first column/row, or I'm doing something wrong?

Thanks!

Re: Saving a string with more than 3 characters in a dataset [Re: VizTra] #483595
06/18/21 06:32
06/18/21 06:32
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
Your dataset has wrong number of fields. For 6 fields its dataNew(...6), not 4.

Re: Saving a string with more than 3 characters in a dataset [Re: Petra] #483598
06/18/21 18:16
06/18/21 18:16
Joined: Jun 2021
Posts: 3
Brazil
D
damasceno Offline
Guest
damasceno  Offline
Guest
D

Joined: Jun 2021
Posts: 3
Brazil
Yes, I simulated with dataNew(...6) but copied the code with dataNew(...4) here, but the problem is the same

Re: Saving a string with more than 3 characters in a dataset [Re: VizTra] #483599
06/18/21 20:38
06/18/21 20:38
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
"Every record begins with an 8-byte date/time field."

So, column [0] is treated as a double.

Re: Saving a string with more than 3 characters in a dataset [Re: Zheka] #483604
06/20/21 03:40
06/20/21 03:40
Joined: Jun 2021
Posts: 3
Brazil
D
damasceno Offline
Guest
damasceno  Offline
Guest
D

Joined: Jun 2021
Posts: 3
Brazil
Thanks Zheka!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1