![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Aug 2007
Posts: 310
Thanks: 3
Thanked 2 times in 2 posts
|
How do I programmatically get the PeriodType of the current chart for use within Initialize()?
Thanks, Mike
Last edited by Mike Winfrey; 03-14-2010 at 09:24 AM.
Reason: More information
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
I don't think you can. No bars are available in the Initialization() block. This is how you check bar types though: if (Bars.Period.Id == PeriodType.Tick ) { // Indicator calculation logic here } http://www.ninjatrader-support.com/H...V6/Period.html
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Aug 2007
Posts: 310
Thanks: 3
Thanked 2 times in 2 posts
|
Thanks Ben
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Aug 2007
Posts: 310
Thanks: 3
Thanked 2 times in 2 posts
|
This may not change your answer but thought I'd be more specific just in case.
In the Initialize() method I have Add("$GBPUSD", periodtype, timeframe); Currently, I set periodtype by means of a parameter and actually use PeriodType.Minute. However, I'd like to be able to get the interval setting that is used when opening a new chart and set my periodtype variable based on the chart interval setting instead of through the static parameter. I hope I'm expressing this well enough. Thanks again, Mike |
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
|
Mike, thanks for clarifying - accessing this property dynamically is unfortunately not supported.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Aug 2007
Posts: 310
Thanks: 3
Thanked 2 times in 2 posts
|
Well shucks...thanks Bertrand
|
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Apr 2009
Posts: 208
Thanks: 0
Thanked 4 times in 3 posts
|
Also , see my new thread :
http://www.ninjatrader-support2.com/...d.php?p=158635 |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Aug 2007
Posts: 310
Thanks: 3
Thanked 2 times in 2 posts
|
No I didn't and gave up.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Custom PeriodType | Mike Winfrey | Indicator Development | 12 | 01-28-2013 08:19 AM |
| Add RangeAlt to PeriodType. | shawnj | Suggestions And Feedback | 1 | 10-10-2009 06:34 PM |
| get the periodtype | tomleeson | General Programming | 4 | 07-30-2009 04:57 AM |
| PeriodType.RangeAlt | snaphook | General Programming | 2 | 11-13-2008 08:19 AM |
| Question about PeriodType.Tick | Edgar V. | Strategy Development | 2 | 03-19-2008 03:47 PM |