NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 10-09-2008, 09:02 AM   #1
mazachan
Senior Member
 
Join Date: Jun 2007
Posts: 112
Thanks: 0
Thanked 0 times in 0 posts
Default Dynamic Multiple Time Frames?

Hi, I'm trying to create a multiple time frame dynamically. Essentially what I want to do is, depending on the current time frame of the chart, I would like to create a second time frame say 5 times the current one which is a 3 minute chart.

In the initialize method, I have Add(BarsPeriod.Id, 5 * BarsPeriod.Value);
I have also tried to pull out that multiplication and have it done prior to passing it into the Add function, but when I print out in BarsInProgress == 1, I call the function
Print(BarsArray[1].Period) and it shows up as 5.

Is it possible to dynamically change the value for Add or do I have to pass in a constant?

Any help appreciated.
mazachan is offline  
Reply With Quote
Old 10-09-2008, 09:17 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Unfortunately you cannot access BarsPeriod from within the Initialize() method. This means you will not be able to dynamically load bar objects.
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-21-2008, 04:33 AM   #3
Roman
Junior Member
 
Join Date: Nov 2008
Location: Australia
Posts: 19
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Josh View Post
Unfortunately you cannot access BarsPeriod from within the Initialize() method. This means you will not be able to dynamically load bar objects.
Hi Josh,

Could a request to include some sort of method to get the time frame be included on the "to do" list? This is really a very basic need , considering that NT offers support for multiple time frames. Similar need appears to be obvious for querying an instrument on the chart. Without it is really impossible to write a strategy (or an indicator) that would be flexible enough to be considered universally usefull. Most of us are (or are trying to be) traders, not programmers, so less time we spend on code development the better... Your assistance will be trully appreciated.


Roman
Roman is offline  
Reply With Quote
Old 11-21-2008, 05:09 AM   #4
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Thanks for your suggestion. We'll add it to the list of future considerations.
NinjaTrader_Dierk is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple charts with different times frames. rmmsmh Charting 10 04-12-2009 11:49 PM
Multiple time frames Oli Charting 4 06-26-2008 02:11 AM
Using multiple time frames from days into minutes Sidhartha General Programming 2 04-12-2008 04:34 AM
time frames knightrider123 Market Analyzer 2 07-11-2007 01:09 AM
Dynamic base pointer or time reference for secondary time interval ct Strategy Development 11 06-20-2007 02:27 PM


All times are GMT -6. The time now is 07:44 PM.