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

Rectangle won't draw

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

    Rectangle won't draw

    The following code won't draw the rectangle on tick charts.

    protected override void OnBarUpdate()
    {
    DrawRectangle("tag1", 10, Low[10], 5, High[5], Color.PaleGreen, Color.PaleGreen, 2);
    }

    #2
    Please see this tip: http://www.ninjatrader-support2.com/...ead.php?t=3170
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I got rectangles to draw in my indicator. I can draw a rectangle on the price pane but it's bad, I have to scale things to fit the price range. I cannot get the same code to draw a rectangle in panel2... I added the line DrawOnPricePanel =false to the initializations but nothing draws on panel2. Panel2 just sits there with a scale of 0 to 1...

      I can't get it to overlay on the price either. I assume that would take care of all the scaling work...
      Last edited by maxpi; 06-17-2009, 02:21 PM.

      Comment


        #4
        You actually need something populating panel 2 if you want to draw in there. Please add a plot there and try again.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          It draws just vertical lines on panel2. They appear to be where the right and left edge of the rectangles are intended to be. They all have a height of 1 and the panel2 scale is 1. I can print the values at the time of generating the draw objects, they are not 1, ever..

          Comment


            #6
            I added in the plot by copy /paste from another indicator. It does not show up in the indicator properties as applied to the chart.. Can I fix that or is it necessary to step through the wizard and generate a new indicator?

            Comment


              #7
              maxpi,

              You probably did not copy paste all the components down in the Properties region of the code.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                I've gone mucking about in the properties section before and had to reinstall the .net, no thanks on that idea.

                The main problem I had was an assumption that the rectangle drew from left to right, I had the begin and end values reversed, it was drawing little vertical lines....

                Anyhow, I have the indicator drawing rectangles on panel 2 but the scaling is a problem. I have a plot going because it is necessary. I don't really want to use the plot for anything. If I plot the same height as the rectangle, when I have the last tick on the right edge of the screen, the scaling is ok for the one rectangle that is visible at that point. If I scroll back such that the plot is not visible the scaling just becomes unity and all the rectangles have the same height... I've tried various combinations of booleans both in the indicator code, the Draw code, etc... and I just can't get that scale to be other than unity... If I don't plot, the scale is always unity.
                Last edited by maxpi; 06-18-2009, 10:17 AM.

                Comment


                  #9
                  maxpi,

                  I am not sure what you mean by unity. Please try using a plot that will just set the scale to what you want all the time and then it should work?
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    unity =1. The scale is zero to one except when the plotted value is shown. The entire code operates on realtime bars only, probably the plot scaling applies only to the most recent bar in that case... I have it plotting on the price panel now, I'll have to change the code to run on history bars to draw it on panel2 I'm sure..

                    ty

                    Comment


                      #11
                      Sorry not entirely following you. Just create a plot that actually has a usable scale and then you can draw on it.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        It all runs on realtime data only, that seems to be the crux of the matter, the scaling of panel 2 is ok only when the last tick is visible on the right edge of the screen... it draws ok now overlaying price but it really might be better if I could get it to plot in panel 2.. I'll try allowing it to run on historical data.

                        ty

                        Comment


                          #13
                          maxpi,

                          Not sure what you mean by "last tick showing". The scale should work regardless as long as there are data points. Please provide screenshots/examples. Thank you.
                          Josh P.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by DJ888, 04-16-2024, 06:09 PM
                          4 responses
                          12 views
                          0 likes
                          Last Post DJ888
                          by DJ888
                           
                          Started by terofs, Today, 04:18 PM
                          0 responses
                          11 views
                          0 likes
                          Last Post terofs
                          by terofs
                           
                          Started by nandhumca, Today, 03:41 PM
                          0 responses
                          7 views
                          0 likes
                          Last Post nandhumca  
                          Started by The_Sec, Today, 03:37 PM
                          0 responses
                          3 views
                          0 likes
                          Last Post The_Sec
                          by The_Sec
                           
                          Started by GwFutures1988, Today, 02:48 PM
                          1 response
                          9 views
                          0 likes
                          Last Post NinjaTrader_Clayton  
                          Working...
                          X