Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add additional Periods and Plots to TRIX?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Add additional Periods and Plots to TRIX?

    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
    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]);
    }

    Comment


      #3
      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

      Comment


        #4
        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!

        Comment


          #5
          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.

          Comment


            #6
            Thanks. Did as you suggested and works fine. How can I prevent the parameter settings from displaying in the indicator label?

            JSB

            Comment


              #7
              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.

              Comment


                #8
                I do want to display at one label (TRIX) on the indicator panel but want to exclude the parameter settings from this label display.

                Comment


                  #9
                  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

                  Comment


                    #10
                    Thanks. Will modify Label code as suggested in the sample.

                    JSB

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    581 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    338 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    103 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    554 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    552 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X