Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw Region not coloring between two %D lines (Stochastic Indicator)

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

    Draw Region not coloring between two %D lines (Stochastic Indicator)

    Hi - I am using a custom script to plot two %D lines (from the %D of the Stochastic indicator). Everything works fine but I am not able to use "Draw Region()" to color the space between these %D line plots based on a mathematical condition, which is that if the difference between these two %D plots is >25 then it shades the region between the two using Gray color.

    Attaching a snippet of the code and the output for your reference. Please note in the output the region between the two plots doesn't color Gray. The mathematical condition and Draw region part of the code (referred to above) is from line 146 onwards in the code.

    Attached Files

    #2
    Attaching the code as zip file so that it is easy to import and see in Ninjatrader.
    Attached Files

    Comment


      #3
      Hi - I figured that the draw on the price panel was set to true. I have set that to false so the gray shading happens but the shading is happening for the entire region between the plots irrespective of the condition. Hence, please can you advise on why that might be

      Comment


        #4
        Hi, thanks for posting. When I add the CurrentBar variable to the Tag parameter, I get unique draw objects in grey on the indicator plot:

        Draw.Region(this, "HighGap"+CurrentBar, CurrentBar, 0, D2, D, null, Brushes.Gray, 50, 0);

        If you want to shade in an area, we have an example of this here for reference:

        https://ninjatraderecosystem.com/use...el-with-color/

        The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

        Comment


          #5
          Thanks a lot NinjaTrader_ChrisL

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          88 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          48 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          30 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          34 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          68 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X