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/1415:53.
Re: My attempt to create a .bar file
[Re: Pork]
#435346 01/06/1416:0601/06/1416:06
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:
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 P
Re: My attempt to create a .bar file
[Re: ]
#435353 01/06/1416:5001/06/1416:50
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/1416:5301/06/1416:53
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/1416:5901/06/1416:59
I'm glad I could be help to someone. 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
Re: My attempt to create a .bar file
[Re: Pork]
#435634 01/09/1423:1101/09/1423:11
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/1413:2601/10/1413:26
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.