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

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

    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 carnitron, Today, 08:42 PM
            0 responses
            5 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Today, 07:51 PM
            0 responses
            6 views
            0 likes
            Last Post strategist007  
            Started by StockTrader88, 03-06-2021, 08:58 AM
            44 responses
            3,974 views
            3 likes
            Last Post jhudas88  
            Started by rbeckmann05, Today, 06:48 PM
            0 responses
            8 views
            0 likes
            Last Post rbeckmann05  
            Started by rhyminkevin, Today, 04:58 PM
            4 responses
            58 views
            0 likes
            Last Post dp8282
            by dp8282
             
            Working...
            X