![]() |
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
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Dec 2010
Posts: 2
Thanks: 0
Thanked 0 times in 0 posts
|
I am currently developing multi timeframe indicators. For example, below I developed a simple adx mult timeframe indicator that I can use with range bar types. What I would like to do is adjust this program to be able to receive any type (i.e. minutes, seconds, ticks, etc...) instead of only range. Can anyone give me some guidance on how I would approach this?
protected override void Initialize() { Add(PeriodType.Range, range); Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ADXComp Line")); Overlay = false; CalculateOnBarClose = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired) return; double ADXComp = (ADX(BarsArray[1],adxperiod)[0]); ADXCompLine.Set(ADXComp); } |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi traderjem,
Thanks for the post and welcome to the NinjaTrader forums! For timing reasons, we support only hard coding additional series. This is controlled with the Add() statements, possible values are available here: http://www.ninjatrader.com/support/h...s/nt7/add3.htm
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Dec 2010
Posts: 2
Thanks: 0
Thanked 0 times in 0 posts
|
Hey Ryan
So are you saying I should ADD each potential period type I want and then send a flag from my properties to tell it which type to use (like in a case statement)? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
That could be one way to do it. There is no supported technique for conditionally adding series to your script but you could add all potential series you need. Then work a case statement into OnBarUpdate() for accessing.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#5 | |
|
Senior Member
Join Date: Jul 2008
Posts: 271
Thanks: 4
Thanked 7 times in 7 posts
|
Quote:
It strikes me as wasteful of both memory and CPU to add every possible time frame and then use just one of them. -A |
|
|
|
|
|
The following user says thank you to anachronist for this post: |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multi timeframe indicator | pbayer | Indicator Development | 1 | 05-09-2011 04:46 PM |
| looking for example 6.5 multi-timeframe indicator | tulanch | Indicator Development | 2 | 10-08-2010 12:09 PM |
| Multi timeframe indicator | sergeysamsonov | Indicator Development | 1 | 07-26-2010 06:08 AM |
| Multi-Timeframe indicator | velocity | Version 7 Beta General Questions & Bug Reports | 3 | 12-23-2009 11:28 AM |
| Multi-timeframe indicator referencing | LazKz | Strategy Development | 3 | 03-18-2009 07:24 AM |