Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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

    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.
          BertrandNinjaTrader Customer Service

          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.
              BertrandNinjaTrader Customer Service

              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
                  BertrandNinjaTrader Customer Service

                  Comment


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

                    JSB

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cls71, Today, 04:45 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post cls71
                    by cls71
                     
                    Started by mjairg, 07-20-2023, 11:57 PM
                    3 responses
                    213 views
                    1 like
                    Last Post PaulMohn  
                    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                    4 responses
                    544 views
                    0 likes
                    Last Post PaulMohn  
                    Started by GLFX005, Today, 03:23 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post GLFX005
                    by GLFX005
                     
                    Started by XXtrader, Yesterday, 11:30 PM
                    2 responses
                    12 views
                    0 likes
                    Last Post XXtrader  
                    Working...
                    X