Gamestudio Links
Zorro Links
Newest Posts
Few update suggestions
by 3run. 07/23/21 08:47
FXCM Login Error
by jcl. 07/22/21 08:25
New Zorro version 2.40.1
by dpn. 07/21/21 19:39
MT5 bridge plugin
by jcl. 07/21/21 15:52
FXCM - CFD Price can not be loaded
by jcl. 07/21/21 08:40
AUM Magazine
Latest Screens
Hecknex World
Scheherazade's Journey
Paradox Vector
The Space Between
Who's Online Now
2 registered members (Harry Potter, 1 invisible), 362 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
ace_trader, chrissierra, fredperim, degenerate_762, TalonTrades
18664 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: 6
V
VizTra Offline OP
Newbie
VizTra  Offline OP
Newbie
V

Joined: Apr 2021
Posts: 6
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,565
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,565
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: 363
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 363
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: 564
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 564
"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