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 Stem1 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,335 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?

  #51 (permalink)
 
bluecrow's Avatar
 bluecrow 
Boston, MA
 
Experience: Intermediate
Platform: NT & SC
Broker: DDT and SC/CQG
Trading: NQ, ES, YM
Posts: 42 since Apr 2013
Thanks Given: 163
Thanks Received: 44

Hi,

I was wondering if anyone is using this great tool to export indicator data?

I managed to get it working by:
- downloading and installing the zip file in post #35 of this thread
- disabling chart trader BEFORE working with the installed strategy
- adding the new strategy and customizing the filename and path (see picture below)
- enabling the strategy by changing it's parameter to "True"



The file with your data will look like this.



I'm working on exporting indicator data using this section of the code:

********************
//This is the best place to modify the code to output indicator data if required.

string data = (Time[0].ToString("yyyy-MM-dd HH:mm:ss") + dataSeparator + Close[0] + EMA(14)[0]);
if (splitDateTime == true)
{
data = data.Replace(' ',dataSeparator);
}

sw.WriteLine(data);
break;
*********************

Does anyone have working examples of how this code can be adapted to export indicator data? The EMA example provided in the code is not working for me. I'm curious if others have managed to get it working for them.

Thanks.

Visit my NexusFi Trade Journal Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Futures True Range Report
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Are there any eval firms that allow you to sink to your …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #52 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009

or you can use thus

Reply With Quote
  #53 (permalink)
 
urghan2's Avatar
 urghan2 
Tampere, Finland
 
Experience: Intermediate
Platform: NT, SC, AlphaReveal
Trading: /ES /YM
Posts: 7 since Sep 2012
Thanks Given: 69
Thanks Received: 3


Hi guys,

I'm trying to export data from NT. There are two strategies available for download to do this on nexusfi.com (formerly BMT) (links below):

Export Data:

Data export:

However, there seems to be a bug/deficiency in both of them:

1. At the moment Export Data doesn't export the last 2 months of data. So there's some data lacking form csv file. Lacking data is constantly from the most recent dates. The amount of lacking data varies from time to time. Strategy is downloaded from NT downloads section on nexusfi.com (formerly BMT).

2. Data Export exports all data (thus working correctly), but there's no option available to export date and time columns separately. The option to do that, would make it possible to compare Globex and RTH the way FT71 describes in his Statistical analysis webinar, which is what I'd like to do (among many other things). Doing this manually in Excel is too much work because file has thousands of rows of data. This one is also downloaded from nexusfi.com (formerly BMT) downloads section.

Has anyone a solution to this one?

Thanks in advance,

- J

Reply With Quote
  #54 (permalink)
 
urghan2's Avatar
 urghan2 
Tampere, Finland
 
Experience: Intermediate
Platform: NT, SC, AlphaReveal
Trading: /ES /YM
Posts: 7 since Sep 2012
Thanks Given: 69
Thanks Received: 3


urghan2 View Post
Hi guys,

I'm trying to export data from NT. There are two strategies available for download to do this on nexusfi.com (formerly BMT) (links below):

Export Data:

Data export:

However, there seems to be a bug/deficiency in both of them:

1. At the moment Export Data doesn't export the last 2 months of data. So there's some data lacking form csv file. Lacking data is constantly from the most recent dates. The amount of lacking data varies from time to time. Strategy is downloaded from NT downloads section on nexusfi.com (formerly BMT).

2. Data Export exports all data (thus working correctly), but there's no option available to export date and time columns separately. The option to do that, would make it possible to compare Globex and RTH the way FT71 describes in his Statistical analysis webinar, which is what I'd like to do (among many other things). Doing this manually in Excel is too much work because file has thousands of rows of data. This one is also downloaded from nexusfi.com (formerly BMT) downloads section.

Has anyone a solution to this one?

Thanks in advance,

- J

Hey guys,

Found workaround while still using Data Export. Just export data and modify it in Excel using "DATE" and "TIME" functions to spread date and time to separate columns. Excel ain't my strongest field, but getting better. Thought I'll mention workaround in case someone else has same kind of problem.

- J

Reply With Quote
  #55 (permalink)
 
DaveTrading's Avatar
 DaveTrading 
Barcelona, Barcelona, Spain
 
Experience: Intermediate
Platform: TradingView, ProRealtime
Broker: Interactive Brokers, Tastyworks
Trading: Options, Stocks/ETFs
Posts: 40 since Oct 2010
Thanks Given: 587
Thanks Received: 49


urghan2 View Post
Hi guys,

2. Data Export exports all data (thus working correctly), but there's no option available to export date and time columns separately. The option to do that, would make it possible to compare Globex and RTH the way FT71 describes in his Statistical analysis webinar, which is what I'd like to do (among many other things). Doing this manually in Excel is too much work because file has thousands of rows of data. This one is also downloaded from futures.io (formerly BMT) downloads section.

Has anyone a solution to this one?

Thanks in advance,

- J

Hello @urghan2,
You can export properly date and time using a specific format but for this you need to modify the code. And for example instead of:

 
Code
Time[0].ToString("yyyyMMdd HHmmss")
or just
 
Code
 Time[0]
You need to have something like this:

 
Code
Time[0].ToString("yyyyMMdd") + dataSeparator +Time[0].ToString("HHmmss")
here is a strategy example.
Hope this help.

DaveTrading.

Attached Files
Elite Membership required to download: urghan2Export.cs
Reply With Quote
Thanked by:
  #56 (permalink)
 
DaveTrading's Avatar
 DaveTrading 
Barcelona, Barcelona, Spain
 
Experience: Intermediate
Platform: TradingView, ProRealtime
Broker: Interactive Brokers, Tastyworks
Trading: Options, Stocks/ETFs
Posts: 40 since Oct 2010
Thanks Given: 587
Thanks Received: 49


bluecrow View Post
Hi,

I was wondering if anyone is using this great tool to export indicator data?

I'm working on exporting indicator data using this section of the code:

********************
//This is the best place to modify the code to output indicator data if required.

string data = (Time[0].ToString("yyyy-MM-dd HH:mm:ss") + dataSeparator + Close[0] + EMA(14)[0]);
if (splitDateTime == true)
{
data = data.Replace(' ',dataSeparator);
}

sw.WriteLine(data);
break;
*********************

Does anyone have working examples of how this code can be adapted to export indicator data? The EMA example provided in the code is not working for me. I'm curious if others have managed to get it working for them.

Thanks.

Hello @bluecrow,

Here there is a simplified working example. (it send data on the folder: “C:\TESTNT\”)

If you look at the code you can also see that it’s possible to format the result to have less decimal.
In your code the problem is maybe because there is not the “+ dataSeparator +” section between Close[0] and EMA(14)[0] and also at the end of the line. Compare with the attach strategy.

I’m using this king of strategy a lot in a way of a screener in daily timeframe. Then I make my analysis with an MS Access database or Excel.

DaveTrading.

Attached Files
Elite Membership required to download: DbSimpleExampleExportData.cs
Reply With Quote
  #57 (permalink)
 
Zwaen's Avatar
 Zwaen 
Netherlands, Blaricum
 
Experience: Intermediate
Platform: Excel, Python, R
Broker: IB
Trading: Options
Posts: 250 since Dec 2010
Thanks Given: 848
Thanks Received: 238

Hello,

I have a fairly basic question about exporting minute and tick data in excel. I have an IQ feed subscription and use NT for charting. I want to export minute and tick data to excel to expand analysis. However, regarding the tick data, I don't understand exactly what it represents.

For example, I exported Bid-Ask-Last data for the NQ 03-14 contract for 17 Januari 2014. The High of the day was 3608.75, and 22 contracts were traded at that price:


However, I can not find this information in the exported Bid/Ask/Last Tick data I exported:

It seems there is something 'very basic' I do not understand about the data I export/import.

Can someone explain this to me?

Thanks!

One of my worst enemies are my own false assumptions
Reply With Quote
  #58 (permalink)
 
YertleTurtle's Avatar
 YertleTurtle 
Portland, USA
 
Experience: Intermediate
Platform: Ninjatrader
Trading: ZS
Posts: 215 since May 2011
Thanks Given: 42
Thanks Received: 362

I got fed up with the available indicators that export data from NT to excel. I don't need to do any of this live so I think there is a simpler solution. All you need to do is create a strategy from the code below (the example uses time, and OHLCV each separated by commas). Open the output window (Tools -> Output Window), pull up the chart that you are interested, add the strategy to the chart and be sure to enable it. Once you run it the output window will be identical to a CSV file. Right click to save it as a text file and you can easily import the data into excel. Its an extra step but I think it is easier.

For those who want to look at 24 hour sessions versus pit sessions you need to create a chart created from 1440 minute bars. In the data series popup you can change the Session template to match the pit hours of your particular instrument. Run the strategy as above and you are done.

I'm sure this can be used to export indicator values as well.

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// enables better export of ninjatrader data.
/// </summary>
[Description("enables better export of ninjatrader data.")]
public class DataPrinter : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnStartUp()
{
Print ("Time,Open,High,Low,Close,Volume");
}
protected override void OnBarUpdate()
{
Print(Time[0]+","+Open[0]+","+High[0]+","+Low[0]+","+Close[0]+","+Volume[0]);
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}

Reply With Quote
  #59 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009

Very nice,
Good for you.
Only two remarks:
1. Its better to run a strategy in the strategy analizer. That way you don't need to be connected, don't need a chart.
2. I created a little better strategy. Its in the download section for a long time.

Baruch

Reply With Quote
  #60 (permalink)
 
YertleTurtle's Avatar
 YertleTurtle 
Portland, USA
 
Experience: Intermediate
Platform: Ninjatrader
Trading: ZS
Posts: 215 since May 2011
Thanks Given: 42
Thanks Received: 362



baruchs View Post
Very nice,
Good for you.
Only two remarks:
1. Its better to run a strategy in the strategy analizer. That way you don't need to be connected, don't need a chart.
2. I created a little better strategy. Its in the download section for a long time.

Baruch

Thanks for the input Baruch - I'm new to both NT and programming so I'm sure there are better ways to do this. There is also a limitation to how many lines can print using my method so maybe yours improves on this as well.

Reply With Quote




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