Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

draw a rectangle starting from 2 bars ago

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

    draw a rectangle starting from 2 bars ago

    hello everyone,
    here is what i want to do : draw the 50% of the the 2 last bar , i find the logic of rectangle can do it , but i get only the last bar and it work perfectly , but i coudint get the 2 last bar , always it plot the last bar
    thanks in advance , here is the script

    Draw.Rectangle(this, "meanthreshold",0, Low[0] - ((Low[0]-High[0])/2), -10, High[0] - ((High[0]-Low[0])/2), Brushes.Blue);
    Last edited by deviltrader; 12-18-2022, 10:12 AM.

    #2
    Hello deviltrader,

    Thanks for your post.

    I see that you are specifying a value of 0 for the 'startBarsAgo' property when calling your Draw.Rectangle method.

    If you would like the rectangle to start drawing the rectangle 2 bars ago, you could specify a value of 2 for the startBarsAgo property when calling your method.

    Draw.Rectangle(NinjaScriptBase owner, string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush)

    See this help guide page for more information: https://ninjatrader.com/support/help..._rectangle.htm

    Let me know if I may assist further.
    <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


      #3
      Originally posted by NinjaTrader_BrandonH View Post
      Hello deviltrader,

      Thanks for your post.

      I see that you are specifying a value of 0 for the 'startBarsAgo' property when calling your Draw.Rectangle method.

      If you would like the rectangle to start drawing the rectangle 2 bars ago, you could specify a value of 2 for the startBarsAgo property when calling your method.

      Draw.Rectangle(NinjaScriptBase owner, string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush)

      See this help guide page for more information: https://ninjatrader.com/support/help..._rectangle.htm

      Let me know if I may assist further.


      thank you for the answer ,

      i tried again to change with 2 in place of 0 but it desint plot anything in the chart here is the code


      Draw.Rectangle(this, "meanthreshold",2, Low[2] - ((Low[2]-High[2])/2), -10, High[2] - ((High[2]-Low[2])/2), Brushes.Blue);

      thank you

      Comment


        #4
        You have the start bars ago the same as the end bars ago so of course it will not draw anything. Try using 2 as the start bars ago and 0 as the end bars ago. That way it will draw from two bars ago to the current bar.

        Comment


          #5
          Originally posted by Tasker-182 View Post
          You have the start bars ago the same as the end bars ago so of course it will not draw anything. Try using 2 as the start bars ago and 0 as the end bars ago. That way it will draw from two bars ago to the current bar.
          thank you very much

          Comment


            #6
            Originally posted by Tasker-182 View Post
            You have the start bars ago the same as the end bars ago so of course it will not draw anything. Try using 2 as the start bars ago and 0 as the end bars ago. That way it will draw from two bars ago to the current bar.
            i want to thank you again because it is my first try ever to have something personally done , it deosint matter how is effective but this can be the start of trying to learn anything about developping self indicator and self vision thank you

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            630 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            566 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X