Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Instead of using "Bars Ago"

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

    Instead of using "Bars Ago"

    Hello,
    If I want to write a code for drawing a simple "Ray" or "Segment Line" , instead of using High[15] can I specify a specific bar with it's time stamp.
    For example if I want the segment line to start at the high of the 9:32:00 bar and end at the high of 10:16:00 bar , how can this be coded?

    #2
    Hi yellowTrader - you can use GetBar() for this - http://www.ninjatrader-support.com/H...V6/GetBar.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand,
      I just can't figure out whats wrong with the code below.
      It is intended to draw a line from the high of the "barsAgo" to the high of the current bar but for some reason it doesn't work!!! what seems to be the problem?

      if (ToDay(Time[0]) >= ToDay(2009, 2, 10)
      && ToTime(Time[
      0]) >= ToTime(8, 30, 0))
      {
      int barsAgo = GetBar(new DateTime(2009, 2, 11, 9, 40, 0));
      DrawLine(
      "My line" + CurrentBar, barsAgo, High[barsAgo], 0, High[0], Color.White, DashStyle.DashDot, 2);
      }

      Comment


        #4
        Doesn't work as in how does it not work? Please clarify on what behavior you are seeing. Always remember to check Control Center for errors too. Thank you.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I mean that it draws a line from the high of "barsAgo" to the high of all the bars while I only need to draw a line to the high of the current bar. And obviously as a new bar is created it should adjust to that new bar. Right?

          Comment


            #6
            If this is the behavior you want please do not use unique object names. Remove the "+ CurrentBar" from the name string.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Ok. That worked but isn't it suppose to update each time a new bar is added?
              High[0] means the high of the current bar. Right? so how come it doesn't draw to the high of the current? (Note :current bar is changing every time a new bar is generated)

              Comment


                #8
                Are you running this on CalculateOnBarClose = true? If you want this to updated on every tick set this to false in your indicator settings or Initialize() in the code.

                http://www.ninjatrader-support.com/H...BarClose1.html
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  I got it ."calculateonBarsClose" was the problem.
                  How about if I want it to be drawn to the high of a specific bar and end there ( i.e. a specific bar with a time stamp) just like the starting point of the line?

                  Comment


                    #10
                    You can use the same procedure as for the starting point of the line. You will need to use the endBarsAgo and endY parameters then - http://www.ninjatrader-support.com/H.../DrawLine.html
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Thanks.
                      If I want to draw a line from the highest point or lowest point of a range of bars like from 10:20 AM to 11:40 AM , How can I code the range? Can you send me a link regarding this issue?

                      Comment


                        #12
                        http://www.ninjatrader-support2.com/...ead.php?t=8600

                        You need to mix and match different techniques. We do not have sample code we can show you to do exactly what you want.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          That file was very helpful. Thank you.
                          But what do you do when so many lines are overlapping and there is no way to tell what's underneath what? Is there any way to have some kind of data window or to hover the mouse over the lines one could see how many lines are overlapping say @ 820.75 level?

                          Comment


                            #14
                            Unfortunately not, but you could try minimizing lines by only using a unique tag id when you need a new line created.
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              How can these llines be armed so when crossed , an order is sent?
                              Can this be done by additional indicators?
                              If it is a complicated task , can you recommend anyone doing the project for me? and get paid ofcourse.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by op1031, Yesterday, 05:16 PM
                              1 response
                              8 views
                              0 likes
                              Last Post NT-Roland  
                              Started by sinpeople, Today, 07:20 AM
                              1 response
                              3 views
                              0 likes
                              Last Post NT-Roland  
                              Started by Frank1000, Today, 03:05 AM
                              1 response
                              7 views
                              0 likes
                              Last Post NT-Roland  
                              Started by ntdev, Today, 01:14 AM
                              4 responses
                              16 views
                              0 likes
                              Last Post ntdev
                              by ntdev
                               
                              Started by ct, Today, 02:22 AM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_Jason  
                              Working...
                              X