NexusFi: Find Your Edge


Home Menu

 





Multi Time Frame - Index was outside the bounds of the array


Discussion in NinjaTrader

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




 
Search this Thread

Multi Time Frame - Index was outside the bounds of the array

  #1 (permalink)
 Jayswiss 
San Francisco, CA / USA
 
Experience: Intermediate
Platform: NinjaTrader, TradingView
Trading: ES, TF, NQ, CL, GC
Posts: 29 since Jun 2016
Thanks Given: 4
Thanks Received: 3

Hi all... I'm new to ninjatrader and I thought I had an understanding of how MTF should work after reading the NT7. Apparently not. My basic attempt at this generates "index was outside the bounds of the array" error.

Here's a sample of the code:

 
Code
 protected override void Initialize()
        {
			Overlay				= false;

			Add(PeriodType.Minute, 3);                                  // 3 min time frame stored at  index[1]  ??

                        double the3minClose        = Closes[1][0];
			Print(the3minClose);

                        double the3minOpen        = Opens[1][0];
			Print(the3minOpen);
        }

Any suggestions here?


(Sorry this should have been posted in NinjaTrader Programming but I don't seem to be able to move it now)

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
Build trailing stop for micro index(s)
Psychology and Money Management
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
36 thanks
NexusFi site changelog and issues/problem reporting
25 thanks
The Program
20 thanks
GFIs1 1 DAX trade per day journal
19 thanks
  #2 (permalink)
 
srgtroy's Avatar
 srgtroy 
Los Angeles, California Republic
Legendary  R.I.P. 1965-2023 
 
Experience: None
Platform: Sierra Chart
Broker: CQG
Trading: ES
Posts: 1,928 since Jan 2011
Thanks Given: 1,375
Thanks Received: 3,722


Jayswiss View Post
Hi all... I'm new to ninjatrader and I thought I had an understanding of how MTF should work after reading the NT7. Apparently not. My basic attempt at this generates "index was outside the bounds of the array" error.

Here's a sample of the code:

 
Code
 protected override void Initialize()
        {
			Overlay				= false;

			Add(PeriodType.Minute, 3);                                  // 3 min time frame stored at  index[1]  ??

                        double the3minClose        = Closes[1][0];
			Print(the3minClose);

                        double the3minOpen        = Opens[1][0];
			Print(the3minOpen);
        }

Any suggestions here?


(Sorry this should have been posted in NinjaTrader Programming but I don't seem to be able to move it now)

Not even close, to be honest. Please repost in the appropriate thread and I am sure someone will help you:


Reply With Quote
  #3 (permalink)
 Jayswiss 
San Francisco, CA / USA
 
Experience: Intermediate
Platform: NinjaTrader, TradingView
Trading: ES, TF, NQ, CL, GC
Posts: 29 since Jun 2016
Thanks Given: 4
Thanks Received: 3


Thanks, srgtroy. That's a neat offer from Futures.io

I don't want or need it created for me though. Having something specific to create is what helps motivate me to learn the language.

I already have the indicator fully coded & working on another platform, but I intend to take advantage of some of the more useful features of NinjaTrader (e.g. autotrading, optimization) that the other platform is lacking.

- Jay

Started this thread Reply With Quote
  #4 (permalink)
 
srgtroy's Avatar
 srgtroy 
Los Angeles, California Republic
Legendary  R.I.P. 1965-2023 
 
Experience: None
Platform: Sierra Chart
Broker: CQG
Trading: ES
Posts: 1,928 since Jan 2011
Thanks Given: 1,375
Thanks Received: 3,722

Have you read the whole "NinjaScript" section of the NT7 Help Guide, specifically? That's the first order of business. You may also want to watch this:


@sam028 Where does this thread belong?

Reply With Quote
Thanked by:
  #5 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629

@Jayswiss, you can't access to bars values in Initialize(), this is what generates your error.
Check the genuine SampleMultiTimeFrame strategy, it's a good example, and the NT7 help (NinjaScript > Educational Resources > Tips > Multi-Time Frame & Instruments).

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #6 (permalink)
 Jayswiss 
San Francisco, CA / USA
 
Experience: Intermediate
Platform: NinjaTrader, TradingView
Trading: ES, TF, NQ, CL, GC
Posts: 29 since Jun 2016
Thanks Given: 4
Thanks Received: 3

Thanks! Yes, I've since realized some of that doesn't belong in initialize section.

Thanks for the tip, I'll check the SampleMultiTimeFrame strategy.

Started this thread Reply With Quote




Last Updated on July 3, 2016


© 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