NexusFi: Find Your Edge


Home Menu

 





How to Export DataSeries from NT to Excel?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one MXASJ with 13 posts (28 thanks)
    2. looks_two Fat Tails with 9 posts (6 thanks)
    3. looks_3 Big Mike with 5 posts (0 thanks)
    4. looks_4 YertleTurtle with 4 posts (0 thanks)
      Best Posters
    1. looks_one MXASJ with 2.2 thanks per post
    2. looks_two baruchs with 1 thanks per post
    3. looks_3 DaveTrading with 1 thanks per post
    4. looks_4 Fat Tails with 0.7 thanks per post
    1. trending_up 41,941 views
    2. thumb_up 43 thanks given
    3. group 27 followers
    1. forum 65 posts
    2. attach_file 20 attachments




 
Search this Thread

How to Export DataSeries from NT to Excel?

  #11 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

The first error would indicate you have two programs trying to access a file at the same time. The way the code works is it opens a file in OnBarUpdate() and doesn't close it until OnTermination() ie you can not access the file until the Strategy is disabled.

It also looks like you are trying your own naming convention for the files. You might want to try the defaults first (UseDefaultFilename = true, in which case the Filename variable is not used by the code). It should look like "ES_12_10_5_Minute." Once it works with the defaults you can then play around to make it suit your needs.

Note I use this on NT7 and haven't tried it on 6.5. Also note declaration "using System.IO" needs to be up top.

EDIT: Just noted you referred to that code as an "Indicator." It is a Strategy. There may still be some older code of mine floating around this site as this was originally started as an Indicator. Suggest you use the one I posted, which is v3.10 released 22.2.2010.

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
About a successful futures trader who didnt know anythin …
Psychology and Money Management
Cheap historycal L1 data for stocks
Stocks and ETFs
Better Renko Gaps
The Elite Circle
 
  #12 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


MXASJ View Post
The first error would indicate you have two programs trying to access a file at the same time. The way the code works is it opens a file in OnBarUpdate() and doesn't close it until OnTermination() ie you can not access the file until the Strategy is disabled.

It also looks like you are trying your own naming convention for the files. You might want to try the defaults first (UseDefaultFilename = true, in which case the Filename variable is not used by the code). It should look like "ES_12_10_5_Minute." Once it works with the defaults you can then play around to make it suit your needs.

Note I use this on NT7 and haven't tried it on 6.5. Also note declaration "using System.IO" needs to be up top.

EDIT: Just noted you referred to that code as an "Indicator." It is a Strategy. There may still be some older code of mine floating around this site as this was originally started as an Indicator. Suggest you use the one I posted, which is v3.10 released 22.2.2010.

Yes, I have used the indicator ExportChartData.cs and applied it to my chart.

There are not two programs trying to access the file. I have only applied the indicator and nothing else. I have not tried any own naming conventions, but this might be due to country settings. So far there are two error messages pointing to a problem with the code.

Prior to this I had tried the stategy, but it did not run either.

Started this thread Reply With Quote
  #13 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800


Sorry to hear that FT. I've got it running on three NT7 beta 21 installs (2 Win7/1 Server 2008R2) without any issue. If it gets figured out what the problem is I'll update my code to make it more robust.

Reply With Quote
  #14 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


MXASJ View Post
Sorry to hear that FT. I've got it running on three NT7 beta 21 installs (2 Win7/1 Server 2008R2) without any issue. If it gets figured out what the problem is I'll update my code to make it more robust.

I will have a look again. Only had a short try yesterday. There is no urgence.

Started this thread Reply With Quote
  #15 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,527 since Oct 2009
Thanks Given: 4,176
Thanks Received: 6,020

These two tasks, exporting datas and opening a DDE connection between Excel and the charting app are so easy in Metatrader. Why must this be so complex in a more modern application ?

Reply With Quote
Thanked by:
  #16 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271


trendisyourfriend View Post
These two tasks, exporting datas and opening a DDE connection between Excel and the charting app are so easy in Metatrader. Why must this be so complex in a more modern application ?

because DDE is obsolete which M$ or .Net (which Ninja is built on) no longer supports.

Reply With Quote
  #17 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800


bukkan View Post
because DDE is obsolete which M$ or .Net (which Ninja is built on) no longer supports.

It is also slow and expensive, but I digress...

Reply With Quote
  #18 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

Hi Fat Tails,

I fixed a bug in my ExportData code that would throw an exception if there was a space in the path name (such as "My Documents"), and added a Try/Catch block around the StreamWriter functions.

Hope it helps. cs file attached.

Attached Files
Elite Membership required to download: ExportData.cs
Reply With Quote
  #19 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

If anyone finds this using the "Search" function please note the ExportData code has been updated in the Downloads section. The URL is referenced in post #3.

Reply With Quote
Thanked by:
  #20 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184



Fat Tails View Post
I will have a look again. Only had a short try yesterday. There is no urgence.

Fat Tails,

There is an older discussion thread on the NT forum that I think might be useful for you:
Problem writing to file during strategy optimisation - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum

Jon

Reply With Quote
Thanked by:




Last Updated on April 28, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts