![]() |
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: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
Newbie question here....
I want to add additional Periods and Plots to the TRIX indicator as included in the NT 6.5. System Indicators. I figured out how to add the add the additional Plots to the 'stock' indicator code but I can't absolutely determine what portion of the code calculates the Periods and Input. I believe this is the portion of the code that calculates the Periods: if (CurrentBar == 0) { Value.Set(Input[0]); return; } EMA tripleEma = EMA(EMA(EMA(Input, period), period), period); double trix = 100 * ((tripleEma[0] - tripleEma[1]) / tripleEma[0]); Default.Set(trix); Signal.Set(EMA(Default, signalPeriod)[0]); } Can anyone offer any guidance on how I would modify this code to indicate FOUR TRIX Periods and FOUR TRIX Plots? Many thanks!! ![]() JSB |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
JSB, welcome to our forums here - are you looking simply looking for 4 times smoothed TRIX?
protected override void OnBarUpdate() { if (CurrentBar == 0) { Value.Set(Input[0]); return; } EMA quadEma = EMA(EMA(EMA(EMA(Input, period), period), period), period); double trix = 100 * ((quadEma[0] - quadEma[1]) / quadEma[0]); Default.Set(trix); Signal.Set(EMA(Default, signalPeriod)[0]); }
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
Yes, I believe this is what I desire. I will try the code snippet and advise as to my success. Many thanks for your quick reply and your help!
JSB |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Bertrand -
The code snippet that you provided did not accomplish what I am try to accomplish with the TRIX indicator. What I want to do is plot 4 EMA Periods and a Signal on one TRIX indicator - and have input access to the Periods and Signal in the Parameter section of the indicator configuration window. The image below will give you an idea what I am driving toward. Thanks!
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
The easiest to setup the chart you have is just load the TRIX then 4 times to it with your custom period settings, as you load the indicator to the chart just select to plot them all in the same Panel.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks. Did as you suggested and works fine. How can I prevent the parameter settings from displaying in the indicator label?
JSB |
|
|
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
You would need to setup the indicators then with a blanked outn label field in the indicator properties, then the paramters and indicator names are not displayed at all.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
I do want to display at one label (TRIX) on the indicator panel but want to exclude the parameter settings from this label display.
|
|
|
|
|
|
#9 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
You would need to address this then in your code via the steps shown in the sample - http://www.ninjatrader.com/support/f...ead.php?t=4749
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks. Will modify Label code as suggested in the sample.
JSB |
|
|
|
![]() |
| Tags |
| additional periods, additional plots, multiple periods, multiple plots, trix |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding additional Plots to my indicator | mefTrader | Indicator Development | 5 | 12-30-2009 01:58 PM |
| ERROR: Failed to call 'Add' method for period type 'Tick' | RK_trader | Miscellaneous Support | 24 | 06-04-2009 05:49 AM |
| Trix | rtj4201 | Indicator Development | 29 | 03-18-2009 07:41 AM |
| Trix Histogram | T2020 | Indicator Development | 0 | 03-03-2009 09:08 AM |
| Using the TRIX | Stainless2000 | ATM Strategies (Discretionary Trading) | 1 | 08-26-2008 10:34 AM |