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
2 registered members (monk12, Quad), 830 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
Page 1 of 2 1 2
How to use dataFromCSV #485937
05/13/22 13:13
05/13/22 13:13
Joined: Mar 2021
Posts: 42
Casablanca, Morocco
anissyo Offline OP
Newbie
anissyo  Offline OP
Newbie

Joined: Mar 2021
Posts: 42
Casablanca, Morocco
Hello guys,

I need to use this function to read some CSV file, I am unable to figure out how this function works

dataFromCSV (int Handle, string Format, string Filename, int Column, int Offset)

what I don't understand is the Handle, the Format and Offeset.

cheers,

Re: How to use dataFromCSV [Re: anissyo] #485938
05/13/22 13:49
05/13/22 13:49
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
The dataset function arguments (Handle, Format, and Offset) are described near the bottom of the manual page:
https://zorro-project.com/manual/en/data.htm

Re: How to use dataFromCSV [Re: anissyo] #485939
05/13/22 15:25
05/13/22 15:25
Joined: Mar 2021
Posts: 42
Casablanca, Morocco
anissyo Offline OP
Newbie
anissyo  Offline OP
Newbie

Joined: Mar 2021
Posts: 42
Casablanca, Morocco
I tried my friend i used this code :


Code
#include <contract.c>
function run()

{

LookBack = 100;
set(LOGFILE);
BarPeriod = 600;
set(PLOTNOW);


int column = dataFromCSV (1,"CSV", "aaa", 1, 1);

print (TO_LOG,column);
}



all I get is : Error 058: Bad code 'C' for '2, "1.7 Cub' in aaa.csv

PS: I have the CSV file in the history folder

Re: How to use dataFromCSV [Re: anissyo] #485941
05/13/22 15:42
05/13/22 15:42
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
"CSV" isn't a string format and "aaa" isn't a file name. Please read the link again that Andrew has provided.

When you still receive a 058 message after fixing this then have a look at the error message section.

https://zorro-project.com/manual/en/errors.htm

Re: How to use dataFromCSV [Re: anissyo] #485942
05/13/22 15:52
05/13/22 15:52
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Also, definitely check out the CSVtoHistory script included with Zorro for some excellent sample code.

Not all CSVs are made the same, so you will need to edit the CSV format to suit. See, you have different kinds of time stamps and field values to work with. Plus the sort order can be backwards.

Re: How to use dataFromCSV [Re: anissyo] #485944
05/13/22 16:06
05/13/22 16:06
Joined: Mar 2021
Posts: 42
Casablanca, Morocco
anissyo Offline OP
Newbie
anissyo  Offline OP
Newbie

Joined: Mar 2021
Posts: 42
Casablanca, Morocco
Hello guys, thanks for the replies, really appreciate it

this CSV file contains some breakouts that I detected using a python script, I want to take those break out and add them as signals in my zorro script so the format is irrelevant I guess since the format of the column is as follow: "YYYY/MM/DD strong up" or "YYYY/MM/DD medium up" or "YYYY/MM/DD weak down" etc. I just want to get the values from the CSV, regardless of what format is being used.

By the way Andrew I use occasionally CSVtoHistory to convert my data to T format, and I don't see datafromCSV used in the script...

Last edited by anissyo; 05/13/22 16:13.
Re: How to use dataFromCSV [Re: anissyo] #485945
05/13/22 16:19
05/13/22 16:19
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
What are you trying to do with the CSV, exactly?

Re: How to use dataFromCSV [Re: anissyo] #485946
05/13/22 16:27
05/13/22 16:27
Joined: Mar 2021
Posts: 42
Casablanca, Morocco
anissyo Offline OP
Newbie
anissyo  Offline OP
Newbie

Joined: Mar 2021
Posts: 42
Casablanca, Morocco
I want to extract the data from that CSV, every cell contains a date followed by "strong up" or "medium down" etc. but the format is as follows: "YYYY/MM/DD strong up"
every cell contains values extracted from an end-of-day candles break-out detector that I coded in python.

and I will write a c lite script to check if I am on a break-out day and then try some intraday strategies to see the result, how to get the CSV values? lol

Last edited by anissyo; 05/13/22 16:29.
Re: How to use dataFromCSV [Re: anissyo] #485948
05/14/22 06:58
05/14/22 06:58
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
First convert your data to CSV. You only need a comma after the date, a simple find/replace should do.

Then read the CSV with dataParse.

Re: How to use dataFromCSV [Re: anissyo] #485949
05/14/22 13:19
05/14/22 13:19
Joined: Mar 2021
Posts: 42
Casablanca, Morocco
anissyo Offline OP
Newbie
anissyo  Offline OP
Newbie

Joined: Mar 2021
Posts: 42
Casablanca, Morocco
ok i will try, i found this line here in an example in documentation : int Records = dataParse(1,Format,"History\\BTCEUR.csv");

the only thing I am not understanding is the Format argument, what should I do in Format in my case ?? Let's say for example that the CSV contains one line: "AAA;BBB;CCC" how to get this value from within the CSV ?? what format should I use ??

Thanks a lot my friend =)

Last edited by anissyo; 05/14/22 13:25.
Page 1 of 2 1 2

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1