Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to get region to fill

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

    Unable to get region to fill

    I've tried to get the region between 0 and the plot to fill in unsuccessfully. Can someone please help me sort this out? The plots are displayed on the chart and I've made numerous attempts based on what's been discussed in the forum here and on the help guides but cannot seem to get it right. Wt1, Wt2, and Diff are oscillator examples I'm trying to shade the region between the plot line and zero.

    Code:
                Wt1[0]     = xx[0];
                if (Wt1[0] > 0)
                    Draw.Region(this, "Wt1UP", CurrentBar, 0, Wt1, zero[0], Plots[3].Brush, Plots[3].Opacity);
                if (Wt1[0] < 0)
                    Draw.Region(this, "Wt1DN", CurrentBar, 0, Wt1, zero[0], Plots[3].Brush, Plots[3].Opacity);
                
                Wt2[0]     = SMA(Wt1, 4)[0];
                if (Wt2[0] > 0)
                    Draw.Region(this, "Wt2UP", CurrentBar, 0, Wt2, 0, Plots[4].Brush, Plots[4].Opacity);
                if (Wt2[0] < 0)
                    Draw.Region(this, "Wt2DN", CurrentBar, 0, Wt2, 0, Plots[4].Brush, Plots[4].Opacity);
                
                Diff[0] = Wt1[0] - Wt2[0];
                if (Diff[0] > 0)
                    Draw.Region(this, "DiffUP", CurrentBar, 1, Diff, 0, Plots[5].Brush,  Plots[5].Opacity);
                if (Diff[0] < 0)
                    Draw.Region(this, "DiffDN"+CurrentBar, 1, 0, Diff, zero[0], Plots[5].Brush,  Plots[5].Opacity);​

    #2
    I found the issue DrawOnPricePanel was set to true.

    Is there an example script that features SetZOrder? I understand it's not an often utilized item, but the documentation for it seems like it could be a bit more verbose and additional examples might be helpful.
    Last edited by Conceptzx; 01-14-2024, 11:35 AM.

    Comment


      #3
      Hello Conceptzx,

      Thanks for your notes.

      I am happy to hear you resolved the issue.

      We do not have a reference sample available demonstrating the use of SetZOrder() specifically.

      See the help guide documentation below for more information.

      SetZOrder(): https://ninjatrader.com/support/help.../setzorder.htm
      ZOrder: https://ninjatrader.com/support/help...art_zorder.htm
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment


        #4
        I read it but I'm still lost on how to use it in the script.

        Comment


          #5
          Hello Conceptzx,

          Thanks for your notes.

          SetZOrder() should be done once the State has reached State.Historical.

          Attached is a very simple test script demonstrating setting the z order so an indicator plot appears behind the bars on a chart.

          ​SetZOrder(): https://ninjatrader.com/support/help.../setzorder.htm
          ZOrder: https://ninjatrader.com/support/help...art_zorder.htm
          Attached Files
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment


            #6
            Thank you. I'll check it out and hopefully it'll help me figure out what I had wrong.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            42 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            25 views
            0 likes
            Last Post PaulMohn  
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            162 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            98 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            157 views
            2 likes
            Last Post CaptainJack  
            Working...
            X