Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing a rectangle

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

    #16
    Hello outsource,

    Thank you for your response.

    IRectangle works properly, I just need to try to explain this better to you.

    When we pass the reactangle.EndY to the DataSeries (please confirm you are able to complete this at the least) then we need to expose the value and call it form the indicator's method in the strategy.

    Comment


      #17
      Originally posted by NinjaTrader_PatrickH View Post
      Hello outsource,

      Thank you for your response.

      IRectangle works properly, I just need to try to explain this better to you.

      When we pass the reactangle.EndY to the DataSeries (please confirm you are able to complete this at the least) then we need to expose the value and call it form the indicator's method in the strategy.
      I attached the file for you to review in order to be sure i was able to pass the reactangle.EndY to the DataSeries.I attached the example in the post # 13



      Didn`t you check?

      Comment


        #18
        Hello Outsource,

        Thank you for your response.

        You are setting the DataSeries correctly and exposing it. How are you calling the indicator and it's exposed DataSeries though?

        Comment


          #19
          Originally posted by NinjaTrader_PatrickH View Post
          Hello Outsource,

          Thank you for your response.

          You are setting the DataSeries correctly and exposing it. How are you calling the indicator and it's exposed DataSeries though?

          Code:
          For Longs -> if(
          					   this.Close[0] > this.bvo.BlackBox[0])
          
          do smth.
          
          For Shorts -> if(
          					   this.Close[0] < this.bvo.BlackBox[0])
          
          do smth.

          and i want to combine it with the Climax Bar which is exposed as IntSeries and under barCode.Set(1)

          Its formula is :

          Code:
          if (pressure >= lpMax && volume > lvolSMA)
          			{	
          				barCode.Set(1);
          How do i do all this?

          Comment


            #20
            Hello outsource,

            What is the condition that you want? Please detail this however you want and I can provide an example in code.

            Comment


              #21
              Originally posted by NinjaTrader_PatrickH View Post
              Hello outsource,

              What is the condition that you want? Please detail this however you want and I can provide an example in code.
              The conditions is by defualt in the code is as follows:

              Code:
              if (pressure >= lpMax && volume > lvolSMA)
              			{	
              				barCode.Set(1);
              From there goes the rectangle,which starts from the High and Low of this bar:

              Code:
              if (pressure >= lpMax && volume > lvolSMA)
              Next,i ewant to acces the last bar of the rectangle via strategy.So,i f the nar is -10,as per this example:

              Code:
              if (Condition)
              this.DrawRectangle("Rec", false, 0, High[0], [B]-10[/B], Low[0], Color.Blue, Color.Blue, 3);
              I want to enter long when the 10th bar`s Close > then 10th bar`s Open and vice versa for shorts.

              Hope this clear

              Thank you!

              Comment


                #22
                Hello outsource,

                Can you provide some sort of pseudo code or a simplified version of your code?

                I fail to understand how you wish to incorporate your barCode into the Close going over or under the rectangle's EndY.

                Comment


                  #23
                  Originally posted by NinjaTrader_PatrickH View Post
                  Hello outsource,

                  Can you provide some sort of pseudo code or a simplified version of your code?

                  I fail to understand how you wish to incorporate your barCode into the Close going over or under the rectangle's EndY.
                  barCode is the reference,starting point,from which ther rectangle is growing/projecting.

                  As soon as the rectangle`s value is reached,depending on the close relative to that value, the position is opened.

                  What`s that to add more?Please, let me know if there`s anything else.

                  Comment


                    #24
                    Hello,

                    Thank you for your note.

                    When you ask what else is needed, basically the specifics are needed.

                    For example, the rectangle doesn't have 1 value. There is a StartTime, StartY, EndTime, and EndY. Are you referring to the StartY or EndY?


                    First you will need the rectangle object saved to an IRectangle.

                    IRectangle myRect = DrawRectangle("myRect", true, 5, Low[0]-5*TickSize, 0, High[0]+5*TickSize, Color.Blue, Color.Blue, 9)

                    Then you can find when the close is above the bottom of the rectangle you can use:

                    if (Close[0] > myRect.StartY)
                    {
                    // execute code
                    }

                    To find when the close is below the top of the rectangle you can use:

                    if (Close[0] < myRect.EndY)
                    {
                    // execute code
                    }

                    Below is a link to the help guide on IRectangle.
                    http://www.ninjatrader.com/support/h...irectangle.htm
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #25
                      Originally posted by NinjaTrader_ChelseaB View Post
                      Hello,

                      Thank you for your note.

                      When you ask what else is needed, basically the specifics are needed.

                      For example, the rectangle doesn't have 1 value. There is a StartTime, StartY, EndTime, and EndY. Are you referring to the StartY or EndY?


                      First you will need the rectangle object saved to an IRectangle.

                      IRectangle myRect = DrawRectangle("myRect", true, 5, Low[0]-5*TickSize, 0, High[0]+5*TickSize, Color.Blue, Color.Blue, 9)

                      Then you can find when the close is above the bottom of the rectangle you can use:

                      if (Close[0] > myRect.StartY)
                      {
                      // execute code
                      }

                      To find when the close is below the top of the rectangle you can use:

                      if (Close[0] < myRect.EndY)
                      {
                      // execute code
                      }

                      Below is a link to the help guide on IRectangle.
                      http://www.ninjatrader.com/support/h...irectangle.htm
                      ,

                      Hi,

                      i said numerous times that this line in the code is the starting period:

                      Code:
                      if (pressure >= lpMax && volume > lvolSMA)
                      Now,how do you combine both?What else?what else?whatelse?

                      Comment


                        #26
                        Should i just put the draw rectangle statement below this statement:

                        Code:
                        if (pressure >= lpMax && volume > lvolSMA)
                        			{	
                        				barCode.Set(1); 
                                                        this.DrawRectangle("Rec", false, 0, High[0], -10, Low[0], Color.Blue, Color.Blue, 3);
                        But before doing so,these parts should be in place:

                        Code:
                         #region Variables
                        		private DataSeries blackBox;
                                #endregion
                        
                                protected override void Initialize()
                                {
                        			blackBox = new BlackBox(this);
                                }
                        
                                protected override void OnBarUpdate()
                                {
                        			IRectangle rectangle = DrawRectangle("Rec", false, 0, High[0], -10, Low[0], Color.Blue, Color.Blue, 3);
                        			
                        			blacBox.Set(rectangle.EndY);
                                }
                        
                                #region Properties
                                [Browsable(false)]
                                [XmlIgnore()]
                                public DataSeries BlackBox
                                {
                                    get { return blackBox; }
                                }
                                #endregion
                        Would this work out?

                        Can please also tell me what the false statement is trying to do in the code?

                        DrawRectangle("Rec", false, 0, High[0], -10, Low[0], Color.Blue, Color.Blue, 3);
                        Last edited by outsource; 04-03-2015, 05:06 PM.

                        Comment


                          #27
                          Hey guys,

                          so what`s the thing with the rectangle data series?The topic is still opened.Can we make it,can we make it?

                          Cheers,gents!

                          Comment


                            #28
                            Originally posted by outsource View Post

                            Can please also tell me what the false statement is trying to do in the code?

                            DrawRectangle("Rec", false, 0, High[0], -10, Low[0], Color.Blue, Color.Blue, 3);
                            The False statement you highlighted is the value for "Auto scale".
                            Please learn more here: http://www.ninjatrader.com/support/h...irectangle.htm

                            "Auto scale" means the chart will automatically scale to make the rectangle always visible to you.

                            Cheers.
                            Pi
                            ninZa
                            NinjaTrader Ecosystem Vendor - ninZa.co

                            Comment


                              #29
                              Originally posted by ninZa View Post
                              The False statement you highlighted is the value for "Auto scale".
                              Please learn more here: http://www.ninjatrader.com/support/h...irectangle.htm

                              "Auto scale" means the chart will automatically scale to make the rectangle always visible to you.

                              Cheers.
                              Pi
                              Hi ninZa,

                              Thank you for your note!

                              I think I got the syntax by now,and yet I'm still unable to get it into strategy.

                              Comment


                                #30
                                Hello outsource,

                                Thank you for your response.

                                So we do not wish to draw rectangles until the condition if (pressure >= lpMax && volume > lvolSMA) is true?

                                If this is true, we need to assign barCode and blackBox to 0 for example until the condition is true and the values are assigned. Then check if the values are zero before checking them in a condition for the strategy.

                                For example:
                                Code:
                                        #region Variables
                                		private IntSeries barCode;
                                		private DataSeries blackBox;
                                        #endregion
                                
                                        protected override void Initialize()
                                        {
                                			barCode = new IntSeries(this);
                                			blackBox = new DataSeries(this);
                                        }
                                
                                        protected override void OnBarUpdate()
                                        {
                                			if (pressure >= lpMax && volume > lvolSMA)
                                			{
                                				IRectangle rectangle = DrawRectangle("Rec", false, 0, High[0], -10, Low[0], Color.Blue, Color.Blue, 3);
                                				barCode.Set(1);
                                				blackBox.Set(rectangle.EndY);
                                			}
                                			
                                			else
                                			{
                                				barCode.Set(0);
                                				blackBox.Set(0);
                                			}
                                        }
                                
                                        #region Properties
                                        [Browsable(false)]
                                        [XmlIgnore()]
                                        public IntSeries BarCode
                                        {
                                            get { return barCode; }
                                        }
                                		[Browsable(false)]
                                        [XmlIgnore()]
                                        public DataSeries BlackBox
                                        {
                                            get { return blackBox; }
                                        }
                                        #endregion

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                598 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                343 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                103 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                556 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                555 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X