Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
how can I export ES indiv contracts (from NT7) as 1 continuous csv?
Hello, how can I export NT7 tick data from none continuous contract as 1 csv continuous contract ?
Note: I downloaded some continuous and none continuous contract, I can export both but I found a bug, I notice as I download new tick data the old data are being removed (from the continuous contract)....so now I Can not rely on my ES ##-## as it is missing some older data I did have, and if I export the last current ES individual contract then this is all I have in the file, I would like to export all ticks I have from ES as 1 continuous contract.
thanks for your help
w
Can you help answer these questions from other members on NexusFi?
My goal is to export 1 continuous contracts file with only ticks.
As there is a known bug when downloading a continuous contract (like they overwrite older data) with NT UI, I decided to download individual contracts, then to export their ticks by running a backtest (with a slightly modified version of the SampleStreamwritter code from the documentation so it can handle ticks)
But i always end up having this:
"Failed to call method 'Initialize' for indicator 'SampleStreamWriter': The process cannot access the file 'C:\Users\Wilhelm\Documents\NinjaTrader 7\MyTestFile.txt' because it is being used by another process.
Failed to call method 'Initialize' for indicator 'SampleStreamWriter': The process cannot access the file 'C:\Users\Wilhelm\Documents\NinjaTrader 7\MyTestFile.txt' because it is being used by another process."
What other process is locking the file?
Is there another way to export tick data out of NT7 in a csv file?
Maybe another Ninja thread, if you forgot the Dispose() in a previous version?
The easier is to export from Tools -> Historical Data Manager , I don't see why you'll like to use a strategy to do this.
Thanks Sam, my goal is to export all my ZB ticks from jan 2015 to now in a csv file.
Tools -> Historical Data Manager won't work because this imply I use the continuous contract of ZB (to have a nice back adjusted serie), but when I download new data for ZB ##-## from Continuum it always keep 1.5 years of date and overwrite my older data in ZB ##-## (like let say I have Jan2015 to June 2016, then I decide to download all the data missing from now to June 2016, it will erase Jan 2015 to April2015, so I will have left 1.5 years of tick data (from now to May 2015))...basically older data disappear with ZB##-## but they do not disappear in the individual contracts.
So I'm basically looking for a way to export those ticks as one continuous contract by using the individual contracts so I do not have the issue of disappearance of older ticks...The idea was to backtest with a little script from ZB 12-16 so I got a nice continuous contract that goes back to jan 2015. But I have this error of file locked by another process, even after restarting the NT and the machine
You can find which process is using this file in opening the Windows Resource Monitor, from the CPU tab. Select all the processes, then take a look at the "Associated Handles", sort by "Handle name" and search for your .txt file.
I did something similar in the past and it worked, I used a sw.Close() instead of sw.Dispose() but it should do the same thing.
Yeah working! Thanks Sam, I had 2 mistakes:
1- I didn't use close as you did, I just used Dispose, now I use both...working!
2- I move the export code in OnBarUpdate instead of OnMarketData because when you backtest, even if it is tick by tick, it will create bars of 1 tick.....(OnMarketData is never call)
Thanks again
Best
w
Note to future reader: if you know a better way to do it, please do not hesitate to post here. thanks.
Dispose() should close the file too, but if you want to add both...
Correct, OnMarketData will be called after each order book updates, it's useless in your case.
If that feels like too much file opening and closing/releasing, consider using a StringBuilder and writing it out to the file OnTermination()
then in OnMarketData()
Then in OnTermination()
if you're writing lots of data that string could get really big, maybe check the size of it and write it to disk and clear it mid-stream like every megabyte, in OnMarketData()