Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawRegion

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

    DrawRegion

    Hello all,
    I'm trying to fill in the area between 1275 , 1270 on E-mini chart
    so i used
    DrawRegion("tagzone", CurrentBar, 0,1270,1275, Color.Empty, Color.Lime, 2);
    but it is not working , what should be the correct code ?
    Thanks

    #2
    DrawRegion requires a DataSeries for one of the parameters, not two double values.

    Instead you would want to use DrawRectangle.

    DrawRectangle(string tag, bool autoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color, Color backColor, int opacity)
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      When I use DrawRectangle, the rectangle is clickable and movable, and I DON'T want that , any other idea?
      Thanks

      Comment


        #4
        Create yourself a DataSeries that contains only 1275 as the value and then use DrawRegion.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Where is the manual of DataSeries ? or/and if possible show me an example of creating DataSeries and using it with DrawRegion to fill in the area between 1270,1275 on ES chart
          Thanks

          Comment


            #6
            Please see: http://www.ninjatrader-support.com/H...iesObject.html
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Hi bobmike,
              did you get it working ?
              I am also interested in the idea of coloring price-areas.
              Thanks for info
              max-td

              Comment


                #8
                max-td,

                It will work as advertised. You create a DataSeries that holds only one value throughout every bar. Then you just use DrawRegion() to color between that DataSeries and the second value.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks for the explanation !

                  Comment


                    #10
                    after trying some things - got really no idea how to create this with DataSeries.

                    If i use something like this :

                    DrawRectangle("tag1", false, 10, 3280 - 1, 0, 3250 + 1, Color.Green, Color.PaleGreen, 2);

                    what do i have to do to start this ?
                    Last edited by max-td; 09-12-2008, 12:50 PM.

                    Comment


                      #11
                      Max, I also faild to use DataSeries, and I don't wanna use DrawRectangle as the recangle will be clickable and movable, so it ended up doing a trick. by drawing multiple lines using a loop , so when u see them u think it is a zone , but in fact they are lines ,
                      I wouldn't do that in a programing language i'm familiar with.

                      Originally posted by max-td View Post
                      after trying some things - got really no idea how to create this with DataSeries.

                      If i use something like this :

                      DrawRectangle("tag1", false, 10, 3280 - 1, 0, 3250 + 1, Color.Green, Color.PaleGreen, 2);

                      what do i have to do to start this ?

                      Comment


                        #12
                        Please see this Help Guide article on DataSeries. http://www.ninjatrader-support.com/H...iesObject.html
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_Josh View Post
                          Please see this Help Guide article on DataSeries. http://www.ninjatrader-support.com/H...iesObject.html
                          You said the same thing in another post in this thread. the examples in that page are not enough, at least from my point of view
                          Last edited by bobmike; 09-12-2008, 02:44 PM.

                          Comment


                            #14
                            Sorry bobmike. I did not see your post come in after max-td's. The original 1st instance was for you and the second was directed to max-td. Now that you have come back and directed further questions I can help you more.

                            To create a DataSeries you need to follow the steps outlined in the Help Guide link.

                            In the Variables region of the code
                            Code:
                            private DataSeries myDataSeries;
                            In the Initialize() method
                            Code:
                            myDataSeries = new DataSeries(this);
                            In the OnBarUpdate() method
                            Code:
                            myDataSeries.Set(1200);
                            1200 is whatever value you want the DataSeries to take up as.
                            To use this in your DrawRegion() you do this:
                            Code:
                            DrawRegion("tag1", CurrentBar, 0, myDataSeries, 1225, Color.Blue, Color.Green, 2);
                            1225 is your second value for where you wanted to draw the region to.
                            You will effectively have a region drawn between 1200 - 1225.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Hi again,
                              i also tried it with the posted page about the dataseries + found no working example for the problem- so i asked again- well...
                              Josh - the things you posted now work fine - no problems - nice colored region
                              I doubled it and now i have 2 choosable regions.
                              Next step for me would be to create some variables to choose the values for the region when inserting the indicator - instead of having it fix in the code.

                              Tips for that are welcome!
                              I m gonna post the indicator when its done.

                              Josh - is there also an online seminar for basic NinjaScript programming like the seminar for strategy development in your footnote ?

                              max-td

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by szferi, Today, 02:04 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post szferi
                              by szferi
                               
                              Started by MidenThur, Today, 12:52 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post MidenThur  
                              Started by seseoraf, Today, 12:51 AM
                              1 response
                              6 views
                              0 likes
                              Last Post charmingishagarg  
                              Started by Rosario, Today, 12:50 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post Rosario
                              by Rosario
                               
                              Started by kemoyums, Today, 12:38 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post kemoyums  
                              Working...
                              X