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

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
      Paul H.NinjaTrader Customer Service

      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
          Paul H.NinjaTrader Customer Service

          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);
              }
              Paul H.NinjaTrader Customer Service

              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 jclose, Today, 09:37 PM
                0 responses
                4 views
                0 likes
                Last Post jclose
                by jclose
                 
                Started by WeyldFalcon, 08-07-2020, 06:13 AM
                10 responses
                1,413 views
                0 likes
                Last Post Traderontheroad  
                Started by firefoxforum12, Today, 08:53 PM
                0 responses
                10 views
                0 likes
                Last Post firefoxforum12  
                Started by stafe, Today, 08:34 PM
                0 responses
                10 views
                0 likes
                Last Post stafe
                by stafe
                 
                Started by sastrades, 01-31-2024, 10:19 PM
                11 responses
                169 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X