Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator to plot behind price?

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

    Indicator to plot behind price?

    Hi,
    I am guessing it's a simple thing, but I just have not been able to work it out.
    I want to know how to change an indicator to plot behind price rather than in front of price.
    I have played around with the obvious, these 2 lines:
    IsOverlay = true;
    DrawOnPricePanel = true;
    But didn't achieve the desired result.

    So how is it done?

    Cheers,
    Ken.

    #2
    this.ZOrder = 0;
    Should help.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    Comment


      #3
      Hello KennyK,

      Thanks for your post.

      Please see the helpguide (and example) here: http://ninjatrader.com/support/helpG...?setzorder.htm

      Comment


        #4
        Thanks Guys,
        Paul I have done what you suggested and it has not changed any thing.
        This is the "OnStateChange" section:
        protected override void OnStateChange()
        {
        if (State == State.SetDefaults)
        {
        Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDe scriptionDarvas;
        Name = "DarvasKK";
        IsOverlay = true;
        DrawOnPricePanel = true;
        Calculate = Calculate.OnBarClose;
        if (State == State.Historical)
        {
        // Make sure our object plots behind the chart bars
        SetZOrder(-1);
        }

        This indicator is a copy of the NT8 Darvas, the only change I am wanting to make is for it to plot behind the bars. So if you need to look at the rest of the code you know where to find it.
        Cheers,
        Ken.

        Comment


          #5
          Hello KennyK,

          Thanks for your reply.

          Please review the helpguide link previously provided on SetZorder. The example in the helpguide link shows setting in State.Historical and the notes in the link specifically advise, " Assigning specific ZOrder indices to draw at should be done once the State has reached State.Historical"

          Please set the Z-order in State.Historical

          Comment


            #6
            Isn't that what I did?

            Originally posted by NinjaTrader_Paul View Post
            Hello KennyK,

            Thanks for your reply.

            Please review the helpguide link previously provided on SetZorder. The example in the helpguide link shows setting in State.Historical and the notes in the link specifically advise, " Assigning specific ZOrder indices to draw at should be done once the State has reached State.Historical"

            Please set the Z-order in State.Historical
            Isn't that what I did? I did study the help guide first and did as instructed.
            Please advise?

            Cheers,
            Ken.

            Comment


              #7
              Hello KennyK,

              Thanks for your reply.

              In the OnStateChange() method there is the conditional statement of:
              if (State == State.SetDefaults) and the action part is what is captured between { }. The statement you added has been placed in State.SetDefaults { }.

              The condition statement for State.Historical would need to be outside of State.SetDefaults {}. For example

              if (State == State.SetDefaults)
              {
              // all of the state default action statements
              }

              if (State == State.Historical)
              {
              SetZOrder(-1);
              }

              Comment


                #8
                Thanks Paul

                Hey thanks Paul, that made it clear.
                Works a treat now.

                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
                332 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