![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jun 2008
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 post
|
Yes, so long as PriceTypeSupported is set to true.
|
|
|
|
|
|
#3 |
|
Member
Join Date: Jun 2008
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
How would one go about say applying a MACD to Heinken Ashi Bars?
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 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.
|
|
|
|
|
|
#5 |
|
Member
Join Date: Jun 2008
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 post
|
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.
|
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
|
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 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] );
}
|
|
|
|
|
|
#8 |
|
Member
Join Date: Jun 2008
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
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
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |