Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator offset

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

    Indicator offset

    Hi all,

    I have a pretty simple question but after trying a few different codes I've had not luck.

    I would like to offset an indicator by a certain amount of Tick sizes.

    Example would be and SMA, EMA or ATRtrailstop displaced positively or negatively by the input ticksize.

    Any help or Ideas would be greatly appreciative.

    #2
    Hello,

    Thanks for the forum post.

    When you say the below:

    Example would be and SMA, EMA or ATRtrailstop displaced positively or negatively by the input ticksize.
    What do you mean by input ticksize exactly. Not 100 percent following what your trying to do.

    I look forward to assisting you further.

    BrettNinjaTrader Product Management

    Comment


      #3
      Hi Brett,
      I have an indicator that plots a value or line over price on my chart. I would like to be able to offset this indictor by a certain number of ticks positively or negatively.
      attached is an example of what I'm trying to acomplish. The white line would be my new indicator.

      Thanks for the help.
      Attached Files

      Comment


        #4
        Hello,

        In this case if you would like to do this with an indicator would require NinjaScript programming to do this however it is absolutely possible. Are you a programmer?

        Also, what is the name of the indicator your trying to move up?

        I look forward to assisting you further.
        BrettNinjaTrader Product Management

        Comment


          #5
          Thanks Brett,
          I’m not a programmer but I have made some simple scripts in the past. I understand a bit of the script language but am pretty rusty.
          I was thinking that because the indicator already has a plot value “PriceVal” I could just enter a code under Newplot.Set(PriceVal +4*TickSize)
          If I understand right, I could use 4*TickSize which would equal 1 point on the ES.
          To me it should be this easy but still having a hard time coding it. If I can do this with an SMA, I should be able to do it with this indicator.
          This indicator is from a private party and I’m not allowed to share the code.
          Thanks for all the help.

          Comment


            #6
            Hello,

            Exactly you would just have a basic indicator that does what you just quoted to be more exact it would be this instead however.

            Newplot.Set(PriceVal()[0] + 4*TickSize);

            Should do the trick.

            Let me know if I can be of further assistance.
            BrettNinjaTrader Product Management

            Comment


              #7
              The custom indicator has a plot that look like this in the code.
              Add(new Plot(Color.FromKnownColor(KnownColor.Magenta), PlotStyle.Line, "PriceVal"));

              However when I enter the code
              Plot0.Set(PriceVal()[0] + 4*TickSize);
              And compile it I get an error message that says. “The name ‘PriceVal’ does not exist in current context.
              Am I missing something?

              Comment


                #8
                Yes, PriceVal is here just the name of your plot - but you would still need to set a variable holding the value to plot : how would the indicator you wish to call be plotted?

                See my dummy statement below to clarify how this would work, you would call the indicator method with the paramters needed and then add your 4 ticks to achieve the offset desired:

                Plot0.Set(yourCustomIndicatorMethod(DataSeries, Parameter1, Parameter2 ....)[0] + 4*TickSize);

                Comment


                  #9
                  Originally posted by skikg View Post
                  The custom indicator has a plot that look like this in the code.
                  Add(new Plot(Color.FromKnownColor(KnownColor.Magenta), PlotStyle.Line, "PriceVal"));

                  However when I enter the code
                  Plot0.Set(PriceVal()[0] + 4*TickSize);
                  And compile it I get an error message that says. “The name ‘PriceVal’ does not exist in current context.
                  Am I missing something?
                  You need to call by reference to the indicator name, not just the plot, as the class cannot know where the plot came from.

                  Code:
                  Plot0.Set(IndicatorName(IndicatorParams).PriceVal[0] + 4*TickSize);
                  If the called indicator has only one plot, or if you want the default (the one designated by Values[0]), you can just use:

                  Code:
                  Plot0.Set(IndicatorName(IndicatorParams)[0] + 4*TickSize);

                  Comment


                    #10
                    Thanks,

                    Can you explain the data series and IndicatorParams to me. I have add the indicator name and then the PriceVal but I still get the same error.

                    This indicator has three different plots, but I only want to call on the PriceVal plot.

                    Thanks again.

                    Comment


                      #11
                      If you're having trouble with syntax, what may work best is using the strategy wizard to create your indicator + offset. You can select from multiple plots, work with offsets, and then hit view code to see what the code looks like.

                      Ryan M.NinjaTrader Customer Service

                      Comment


                        #12
                        Thanks everyone. Got it figured out and it works greats.

                        Thanks again.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        574 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        333 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        101 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        553 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        551 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X