NT8: DataSeries & Times Help! - NinjaTrader Programming | futures io social day trading
futures io futures trading


NT8: DataSeries & Times Help!
Updated: Views / Replies:314 / 4
Created: by kidvic Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

NT8: DataSeries & Times Help!

  #1 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received

NT8: DataSeries & Times Help!

So I'm trying to get data from a secondary dataseries, week, and minutes.
I'm using the primary dataseries as 15 minutes.

The problem occurs when accessing the weekly dataseries, with a barsago value >= 2.......

the log tells me : Error on calling 'OnBarUpdate' method on bar 229: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

However, I have expanded days to load to 100, and infinite on the max bars lookback, so I don't know what's going!
Please help!
I have attached what's working, and what isn't.
 
Code
			else if (State == State.Configure)
			{
				AddDataSeries(BarsPeriodType.Week, 1); 
				AddDataSeries(BarsPeriodType.Minute, 60); 
			}
		}

		protected override void OnBarUpdate()
		{
			if (CurrentBars[0] <= 0 || CurrentBars[1] <= 0 || CurrentBars[2] <= 0) return;
			
			//these 3 work
			Print(Times[0][0]);
			Print(Times[1][0]);
			Print(Times[2][0]);
			
			//these 3 work
			Print(Times[0][1]);
			Print(Times[1][1]);
			Print(Times[2][1]);
			
			//these 2 work
			Print(Times[0][2]);
			Print(Times[2][2]);
			
			//but this one doesn't
			Print(Times[1][2]);
		}

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Market Wizard
Germany
 
Futures Experience: Intermediate
Platform: Other
Favorite Futures: ES, YM, 6E
 
Posts: 2,586 since Feb 2013
Thanks: 4,754 given, 6,306 received
Forum Reputation: Legendary



kidvic View Post
 
Code
			
		
			if (CurrentBars[0] <= 0 || CurrentBars[1] <= 0 || CurrentBars[2] <= 0) return;

The problem is your above check. It doesn't prevent your code from trying to access bars that
yet don't exist at the time of the first non-return. E.g.: You are trying to access 2 weeks back
before your index provides 2 weekly bars back. Your CurrentBars might be >0 but that doesn't
ensure that the weekly index is >=2.

So in order to avoid that rookie fault: Access doesn't only depend on history which provides
the theoretical possibility of reaching the correct state at all. Particularly your logics must make
sure that at the point of access there is a sufficient number of bars.

It is helpful for most beginners to read the NT sections how bars develop, since the logical fault
of your code is really very basic.


Last edited by choke35; October 3rd, 2016 at 06:27 AM.
Reply With Quote
The following user says Thank You to choke35 for this post:
 
  #4 (permalink)
Market Wizard
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,327 since Dec 2012
Thanks: 11,254 given, 7,063 received
Forum Reputation: Legendary


kidvic View Post
 
Code
	if (CurrentBars[0] < 3 || CurrentBars[1] < 3 || CurrentBars[2] < 3) return;

Try that instead. i.e. I'm checking for at least 3 bars to exist on all of the 3 data series before I can safely access any of them with subscripts [0], [1] or [2].

As @choke35 said, it's a question of whether the bars exist at all yet, effectively the series get going independently. [NB I am assuming 8 behaves similarly to 7 in this respect.]

Just vary the number of bars checked for, depending on your worst-case subscript. In this case I've set them all the same for simplicity. Since many bars will never be seen on screen the 'tightness' of the check is quite arbitrary really, so long as it is safe.

Cheers

Travel Well
Reply With Quote
The following 2 users say Thank You to ratfink for this post:
 
  #5 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received


choke35 View Post
The problem is your above check. It doesn't prevent your code from trying to access bars that
yet don't exist at the time of the first non-return. E.g.: You are trying to access 2 weeks back
before your index provides 2 weekly bars back. Your CurrentBars might be >0 but that doesn't
ensure that the weekly index is >=2.

So in order to avoid that rookie fault: Access doesn't only depend on history which provides
the theoretical possibility of reaching the correct state at all. Particularly your logics must make
sure that at the point of access there is a sufficient number of bars.

It is helpful for most beginners to read the NT sections how bars develop, since the logical fault
of your code is really very basic.

Thanks, it worked.

Reply With Quote
The following user says Thank You to kidvic for this post:

Reply



futures io > > > > > NT8: DataSeries & Times Help!

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

Introducing daytradr by Jigsaw, new stand-alone platform

Oct 19
 

RandBots: AutoTrading Bots to diversify your trading

Oct 24
 

TopstepTrader: Profiting Without Risking Your Own Money

Oct 26

Building Open Source Indicators for NT8 w/Fat Tails @ Lizard Indicators

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sody's Point & Figure NT8 SodyTexas The Elite Circle 8 November 8th, 2016 11:55 AM
NT7, NT8- Get Feed of Price Change to Method/Event & Confirm Order ieitani NinjaTrader Programming 8 July 9th, 2016 05:10 AM
NT8 Time & Sales Problem Segwin The Elite Circle 2 June 21st, 2016 01:28 PM
Help with Arrays or DataSeries Shinkarev NinjaTrader Programming 1 February 12th, 2016 08:00 AM
Multiple dataseries Breakout NinjaTrader 28 March 30th, 2015 12:14 PM


All times are GMT -4. The time now is 07:12 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-10-19 in 0.08 seconds with 20 queries on phoenix via your IP 54.224.50.28