NinjaTrader Support Forum  

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

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 06-27-2008, 05:03 PM   #1
CraigC
Member
 
Join Date: Jun 2008
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
Default Input Series For Indicator

Is it possible to use a different input series for an indicator (other than price)?
Last edited by CraigC; 06-27-2008 at 05:10 PM.
CraigC is offline  
Reply With Quote
Old 06-27-2008, 05:52 PM   #2
Gumphrie
Senior Member
 
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 post
Default

Yes, so long as PriceTypeSupported is set to true.
Gumphrie is offline  
Reply With Quote
Old 06-27-2008, 06:09 PM   #3
CraigC
Member
 
Join Date: Jun 2008
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
Default

How would one go about say applying a MACD to Heinken Ashi Bars?
CraigC is offline  
Reply With Quote
Old 06-27-2008, 06:43 PM   #4
Gumphrie
Senior Member
 
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 post
Default

You can't as price type is not supported on HeikenAshi. Think about it, anything that references High/Low etc.. values directly isn't likely to support price type.
Gumphrie is offline  
Reply With Quote
Old 06-27-2008, 06:52 PM   #5
CraigC
Member
 
Join Date: Jun 2008
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by Gumphrie View Post
You can't as price type is not supported on HeikenAshi. Think about it, anything that references High/Low etc.. values directly isn't likely to support price type.
I'm not sure you have understood my intent, I understand the HA code references the high/low values on the chart and as such cannot be given a single 'DataSeries' as input. What I meant was could I say take the close of a HA bar series and use it to calculate a MA for instance.
CraigC is offline  
Reply With Quote
Old 06-27-2008, 06:58 PM   #6
Gumphrie
Senior Member
 
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 post
Default

You could do that if HeikenAshi exported its values in a Plot or Dataseries, as it doesn't the best option would be to write your own version and then use that with the MA.
Gumphrie is offline  
Reply With Quote
Old 06-28-2008, 03:08 AM   #7
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default

I did something similar to this.

There's one twist you have to handle, and that is that the HaikenAshi indicator as supplied by NinjaTrader has the the ChartOnly attribute set to true in the Initialize() method.

In order to call an indicator, ChartOnly must be set to "false".

Therefore, I created a new copy of the HaikenAshi using "Save As...", naming it HaikenAshiCallable, and I then changed the one line as follows:

Code:
 ChartOnly = false;    // Changed to "false" so indicator can be called from another indicator.
Then I compiled the indicator.

Then I edited the EMA indicator did another "Save As..", calling the result EMA_HiekenAshi, and changed the OnBarUpdate method so it reads as follows:

Code:
 protected override void OnBarUpdate()
{
   DataSeries ha_close = HeikenAshiCallable().HAClose;  // Reference close data series of HeikenAshi indicator.

   Value.Set( EMA( ha_close, period )[0] );
}
Then I compiled it and added it to a chart. It seems to work, but is only slightly different fraom a standard EMA.
KBJ is offline  
Reply With Quote
Old 06-28-2008, 03:58 AM   #8
CraigC
Member
 
Join Date: Jun 2008
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
Default

Cheers for that, the MA on HA was just a example, what I was more interested in is the general chaining together of calculations.
Thanks
CraigC 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
Add an input to an indicator or strategy? maxpi Strategy Development 1 12-04-2007 11:08 AM
Performance of indicator with flexible input Rollins Indicator Development 3 11-05-2007 12:02 AM
Get Indicator Input from Excel Richard Von Indicator Development 7 09-11-2007 07:01 AM
custom Dataseries as indicator input, or input to indi through underlying strategy Nathamus General Programming 3 08-30-2007 12:04 PM
Using a formula or variable as an input to an Indicator nolantx Indicator Development 5 05-24-2007 03:58 PM


All times are GMT -6. The time now is 09:00 PM.