Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (flink, AndrewAMD), 656 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: My attempt to create a .bar file [Re: ] #435345
01/06/14 15:53
01/06/14 15:53
Joined: Jun 2013
Posts: 41
Ohio, USA
P
Pork Offline OP
Newbie
Pork  Offline OP
Newbie
P

Joined: Jun 2013
Posts: 41
Ohio, USA
This is great acidburn!
Got it working with minor changes for filenames and formatting.
I added a printf to try and confirm the writing, but it isn't working out like I expected. Here's the .csv line:
20120102 024400,1.04098,1.04108,1.04098,1.04102,0
here's the printf statement:
printf("\n %f %f %f %f %f",tick.time,tick.fOpen,tick.fHigh,tick.fLow,tick.fClose);
here's the results:
40910.113889 0.010380 0.010376 0.000000 0.000000
The time appears to be OK. the values, not so much.
Is there a better way to confirm the writing?
Thanks,
P

Last edited by Pork; 01/06/14 15:53.
Re: My attempt to create a .bar file [Re: Pork] #435346
01/06/14 16:06
01/06/14 16:06

A
acidburn
Unregistered
acidburn
Unregistered
A



Originally Posted By: Pork
This is great acidburn!
Got it working with minor changes for filenames and formatting.
I added a printf to try and confirm the writing, but it isn't working out like I expected. Here's the .csv line:
20120102 024400,1.04098,1.04108,1.04098,1.04102,0
here's the printf statement:
printf("\n %f %f %f %f %f",tick.time,tick.fOpen,tick.fHigh,tick.fLow,tick.fClose);
here's the results:
40910.113889 0.010380 0.010376 0.000000 0.000000
The time appears to be OK. the values, not so much.
Is there a better way to confirm the writing?
Thanks,
P


Ah, that is strange, yes. Lost half an hour myself, trying to debug that weird issue. Printf format %f expects double, not float! I believe standard C would promote floats to doubles behind your back, but Lite-C doesn't. So you can get the correct output by manually casting all the floats on the right. Like this:

Code:
printf("\n %f %f %f %f %f", (double) tick.time, (double) tick.fOpen...



At least that's how I workaround the same issue.

Re: My attempt to create a .bar file [Re: ] #435347
01/06/14 16:13
01/06/14 16:13
Joined: Jun 2013
Posts: 41
Ohio, USA
P
Pork Offline OP
Newbie
Pork  Offline OP
Newbie
P

Joined: Jun 2013
Posts: 41
Ohio, USA
YEP! That did it. Now they match. WOOOHHOOO!
I had read about manual casting and floats and doubles, but had not found an example and couldn't tell when to do it.
Tell the boss I said it was ok to take an extra 20 out of the petty cash laugh
P

Re: My attempt to create a .bar file [Re: ] #435353
01/06/14 16:50
01/06/14 16:50
Joined: Dec 2013
Posts: 11
J
Jeff_Raven Offline
Newbie
Jeff_Raven  Offline
Newbie
J

Joined: Dec 2013
Posts: 11
Originally Posted By: acidburn

While I'm adding the final piece of magic, if anybody can quickly explain how to add a new instrument to Zorro would be helpful.


1. Open Download.c in Zorro Editor

2. Uncomment the line
#define ADD_ASSET "Copper"

and add your new asset name inside the quotes. For example to add the Eur/Nzd pair, the line is:
#define ADD_ASSET "EUR/NZD"

The format of the asset (currency pair) should include the "/" even though the broker name may be just eurnzd (as it is with FXCM).

3. Make sure the line
#define PRICE_HISTORY

is uncommented.

4. Change the line
StartDate = 2013;

to whatever you want for your start date.

5. Save.

6. In Zorro, Make sure you have a valid User and password filled in, and the account is selected for Demo or Real of that user.

7. Click Test. Zorro should log in and begin a download (not swift), and will beep between years.

8. Close Zorro

9. In any text editor, open the Assets.dta and AssetsFix.dta files. The Assets.dta file will now have a new line in it (in alpha order) for your new asset. Copy that line and paste it into the AssetsFix.dta file in the same relative line location. Save and Close both files.

10. Open Zorro, and the new asset should appear in the list.

Re: My attempt to create a .bar file [Re: Jeff_Raven] #435354
01/06/14 16:53
01/06/14 16:53
Joined: Dec 2013
Posts: 11
J
Jeff_Raven Offline
Newbie
Jeff_Raven  Offline
Newbie
J

Joined: Dec 2013
Posts: 11
Thank you for this work, Pork and acidBurn. I was putting off writing this until I got more comfortable with Lite-C. Now, with a bit of fiddling with the sprintf format, I'll have what I need to migrate some of my MT4 history files into Zorro.

Re: My attempt to create a .bar file [Re: Jeff_Raven] #435355
01/06/14 16:59
01/06/14 16:59

A
acidburn
Unregistered
acidburn
Unregistered
A



Thank you Jeff_Raven!

Although I decided to let others test the script. But I will need this soon, too.

Re: My attempt to create a .bar file [Re: ] #435357
01/06/14 17:50
01/06/14 17:50
Joined: Jun 2013
Posts: 41
Ohio, USA
P
Pork Offline OP
Newbie
Pork  Offline OP
Newbie
P

Joined: Jun 2013
Posts: 41
Ohio, USA
I'm glad I could be help to someone. blush There are still many times that I feel totally inadequate with Zorro.
For those keeping scorecards at home, I've attached my convert file for you.
P

Attached Files
historyconvert.zip (22 downloads)
historyconvert.zip
Re: My attempt to create a .bar file [Re: Pork] #435634
01/09/14 23:11
01/09/14 23:11
Joined: Dec 2013
Posts: 12
F
firesell Offline
Newbie
firesell  Offline
Newbie
F

Joined: Dec 2013
Posts: 12
is there anyway to split a csv file per years ? before importing

Re: My attempt to create a .bar file [Re: firesell] #435658
01/10/14 11:50
01/10/14 11:50
Joined: Jun 2013
Posts: 41
Ohio, USA
P
Pork Offline OP
Newbie
Pork  Offline OP
Newbie
P

Joined: Jun 2013
Posts: 41
Ohio, USA
Hi firesell,
My choice would be decidedly low tech. Open the file in Excel, sort by the date and then copy the years to a separate spreadsheet. I would think I could do this faster than I could create and test a script to write the records to separate csv files. Although I could see how the historyconvert script could be modified to help.
Hope this helps
P

Re: My attempt to create a .bar file [Re: Pork] #435669
01/10/14 13:26
01/10/14 13:26
Joined: Jul 2013
Posts: 522
D
dusktrader Offline
User
dusktrader  Offline
User
D

Joined: Jul 2013
Posts: 522
I was going to suggest a manual way first, but it could quickly get old. If you have to do it more than a handful of times, then it would make sense to automate. In the case of manual, I would choose notepad++ over a spreadsheet program though.

Page 2 of 3 1 2 3

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