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

TSI with signalline

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

    TSI with signalline

    Hi,
    anybody could tell me how adding a signal line to the existing ninjatrader TSI ?
    BR

    #2
    Hello,
    You will need to make a copy of the TSI that you can edit first. You can do this by going to Tools >Edit NinjaScript > Indicator > TSI > press OK> Right Click> Select Save As.. and name your indicator.

    Then you can add a line within the Initialize() method. Please see the following link on how to add a line: http://ninjatrader.com/support/helpGuides/nt7/add.htm

    If we can be of any other assistance please let us know.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Cody,
      i know that but what i mean is adding a trace-line together with the tsi-line, see screenshot.
      Attached Files

      Comment


        #4
        Hello,
        You would need to add a plot that is based off of the same calculations as the signal line that you are referring to.
        Please see the following link on plots: http://ninjatrader.com/support/helpGuides/nt7/plots.htm
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          VALUE problem ??
          protected override void OnBarUpdate()
          {
          if (CurrentBar == 0)
          {
          fastAbsEma.Set(0);
          fastEma.Set(0);
          slowAbsEma.Set(0);
          slowEma.Set(0);
          Value.Set(0);

          }
          else
          {

          double momentum = Input[0] - Input[1];
          slowEma.Set(momentum * (2.0 / (1 + Slow)) + (1 - (2.0 / (1 + Slow))) * slowEma[1]);
          fastEma.Set(slowEma[0] * (2.0 / (1 + Fast)) + (1 - (2.0 / (1 + Fast))) * fastEma[1]);
          slowAbsEma.Set(Math.Abs(momentum) * (2.0 / (1 + Slow)) + (1 - (2.0 / (1 + Slow)))* slowAbsEma[1]);
          fastAbsEma.Set(slowAbsEma[0] * (2.0 / (1 + Fast)) + (1 - (2.0 / (1 + Fast))) * fastAbsEma[1]);
          Value.Set(fastAbsEma[0] == 0 ? 0 : 100 * fastEma[0] / fastAbsEma[0]);
          // Value.Set(slowAbsEma[0] == 0 ? 0 : 100 * slowEma[0] / slowAbsEma[0]); // don't work !!

          }

          Comment


            #6
            Hello,
            Can you clarify if you are trying to set a separate Value data series when you are doing Value.Set a second time or are you seeing that specific Value.Set overload does not work?
            Cody B.NinjaTrader Customer Service

            Comment


              #7
              See variables & Initialize:

              Code:
              public class TSInew : Indicator
                  {
                      #region Variables
                      private int                    fast    = 3;
                      private int                    slow    = 14;
              
                      DataSeries                fastEma;
                      DataSeries                fastAbsEma;
                      DataSeries                slowEma;
                      DataSeries                slowAbsEma;
                      #endregion
              
                      /// <summary>
                      /// This method is used to configure the indicator and is called once before any bar data is loaded.
                      /// </summary>
                      protected override void Initialize()
                      {
                          Add(new Plot(Color.Green, "TSInew"));
                         [COLOR=Red] Add(new Plot(Color.Red, "TSIsign"));[/COLOR]
                          Add(new Line(System.Drawing.Color.DarkViolet, -50, "Lower"));
                          Add(new Line(System.Drawing.Color.DarkViolet, 50, "Upper"));
                          Add(new Line(System.Drawing.Color.Red, 0, "Zero"));
                          fastAbsEma    = new DataSeries(this);
                          fastEma        = new DataSeries(this);
                          slowAbsEma    = new DataSeries(this);
                          slowEma        = new DataSeries(this);
                      }
              I need the signal line (fast=3) with the TSI line.
              What i do, no luck.

              Comment


                #8
                Hello,
                If you are wanting to set the second plot you would need to use Values[1].Set(). Value.Set would take over the TSI plot.
                You will also need to do Values[1].Set(0) in the if(CurrenBar ==0) block.
                For more information on Values please see the following link: http://ninjatrader.com/support/helpG...nt7/values.htm
                Cody B.NinjaTrader Customer Service

                Comment


                  #9
                  Many Thanks Cody, didn't find and understand that little correction. Problem solved.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by LawrenHom, Today, 10:45 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post LawrenHom  
                  Started by love2code2trade, Yesterday, 01:45 PM
                  4 responses
                  28 views
                  0 likes
                  Last Post love2code2trade  
                  Started by funk10101, Today, 09:43 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post funk10101  
                  Started by pkefal, 04-11-2024, 07:39 AM
                  11 responses
                  37 views
                  0 likes
                  Last Post jeronymite  
                  Started by bill2023, Yesterday, 08:51 AM
                  8 responses
                  44 views
                  0 likes
                  Last Post bill2023  
                  Working...
                  X