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 sightcareclickhere, Today, 01:55 PM
                0 responses
                1 view
                0 likes
                Last Post sightcareclickhere  
                Started by Mindset, 05-06-2023, 09:03 PM
                9 responses
                258 views
                0 likes
                Last Post ender_wiggum  
                Started by Mizzouman1, Today, 07:35 AM
                4 responses
                18 views
                0 likes
                Last Post Mizzouman1  
                Started by philmg, Today, 01:17 PM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Started by cre8able, Today, 01:01 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X