NexusFi: Find Your Edge


Home Menu

 





AddDataSeries in Ninjatrader 8


Discussion in NinjaTrader

Updated
    1. trending_up 2,910 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread

AddDataSeries in Ninjatrader 8

  #1 (permalink)
 iq200 
London, UK
 
Experience: Intermediate
Platform: Ninjatrader, Tradestation
Broker: Kinetick, InteractiveBrokers
Trading: Equities, Futures
Posts: 408 since Jun 2010
Thanks Given: 145
Thanks Received: 278

Hi All,
Lets say I am using the 1 minute time frame chart. I now create an indicator in which I want to load 5 years of daily data (I guess using AddDataSeries) to perform some calculations. I can see that there is an API function:

AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)

Is this the correct function to use? What do I set barsPeriod to? Would it be the daily value in minutes i.e. 1440 (24X60 minutes)? Also what do the tradingHoursName and isResetOnNewTradingDay parameters get set to?

Thanks,
iq

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #2 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


iq200 View Post
Hi All,
Lets say I am using the 1 minute time frame chart. I now create an indicator in which I want to load 5 years of daily data (I guess using AddDataSeries) to perform some calculations. I can see that there is an API function:

AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)

Is this the correct function to use? What do I set barsPeriod to? Would it be the daily value in minutes i.e. 1440 (24X60 minutes)? Also what do the tradingHoursName and isResetOnNewTradingDay parameters get set to?

Thanks,
iq

Try a simple:
AddDataSeries(Data.BarsPeriodType.Day, 1);

In your case you don't need one of the other AddDataSeries() methods as there are only required if you want to add another dataserie for another instrument.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #3 (permalink)
 iq200 
London, UK
 
Experience: Intermediate
Platform: Ninjatrader, Tradestation
Broker: Kinetick, InteractiveBrokers
Trading: Equities, Futures
Posts: 408 since Jun 2010
Thanks Given: 145
Thanks Received: 278



sam028 View Post
Try a simple:
AddDataSeries(Data.BarsPeriodType.Day, 1);

In your case you don't need one of the other AddDataSeries() methods as there are only required if you want to add another dataserie for another instrument.

Thanks Sam. One question - how does Ninjatrader know how much data to load? If my primary intraday data series is set to 1 minute and 2 days of data, will Ninjatrader only try to load 2 days of daily data? How can I tell it to load say 5 years rather than 10 years ?

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #4 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


iq200 View Post
Thanks Sam. One question - how does Ninjatrader know how much data to load? If my primary intraday data series is set to 1 minute and 2 days of data, will Ninjatrader only try to load 2 days of daily data? How can I tell it to load say 5 years rather than 10 years ?

I assume it's loading the amount of data related to your primary dataserie.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #5 (permalink)
 iq200 
London, UK
 
Experience: Intermediate
Platform: Ninjatrader, Tradestation
Broker: Kinetick, InteractiveBrokers
Trading: Equities, Futures
Posts: 408 since Jun 2010
Thanks Given: 145
Thanks Received: 278


sam028 View Post
I assume it's loading the amount of data related to your primary dataserie.

But this means that if I want to build support and resistance from 5 years of daily data I need to load 5 years of 1 minute data (primary data series). This is why I was asking my original question in my first post. The point was to be able to use 2-3 days of 1 minute data for the primary series and load more daily data for my indicator.

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #6 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


iq200 View Post
But this means that if I want to build support and resistance from 5 years of daily data I need to load 5 years of 1 minute data (primary data series). This is why I was asking my original question in my first post. The point was to be able to use 2-3 days of 1 minute data for the primary series and load more daily data for my indicator.

In this case you may use another technique, something like this (not tested):
 
Code
BarsPeriod bp = new BarsPeriod();
bp.BaseBarsPeriodType = BarsPeriodType.Day;
bp.BaseBarsPeriodValue = 1;		
AddDataSeries(Instrument.ToString(), bp, 5, "Default 24 x 5", false);

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:
  #7 (permalink)
 iq200 
London, UK
 
Experience: Intermediate
Platform: Ninjatrader, Tradestation
Broker: Kinetick, InteractiveBrokers
Trading: Equities, Futures
Posts: 408 since Jun 2010
Thanks Given: 145
Thanks Received: 278


sam028 View Post
In this case you may use another technique, something like this (not tested):
 
Code
BarsPeriod bp = new BarsPeriod();
bp.BaseBarsPeriodType = BarsPeriodType.Day;
bp.BaseBarsPeriodValue = 1;		
AddDataSeries(Instrument.ToString(), bp, 5, "Default 24 x 5", false);

Thanks Sam.

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #8 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


iq200 View Post
Thanks Sam.

You can also check GetDayBar(), this might be a smarter solution.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #9 (permalink)
 iq200 
London, UK
 
Experience: Intermediate
Platform: Ninjatrader, Tradestation
Broker: Kinetick, InteractiveBrokers
Trading: Equities, Futures
Posts: 408 since Jun 2010
Thanks Given: 145
Thanks Received: 278


sam028 View Post
You can also check GetDayBar(), this might be a smarter solution.

I've got the AddDataSeries working now. Thanks.

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on March 16, 2017


© 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