Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw Vertical Line

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

    Draw Vertical Line

    Hey guys,

    I'm looking to have a vertical Line drawn between a high and a low in an indicator.
    In this example from the help file I get 10 which is bars back. But I'm looking to connect the high and the low for the current bar with a vertical line so it looks similar to the price bar.

    DrawVerticalLine("tag1", 10, Color.Black);

    Could I get some help with setting the start and stop of the line?

    In english I'd like the logic to be: Draw vertical line starting here and ending here for the current bar.

    Thanks a lot.

    #2
    DrawLine("Tag1", 0, highValue, 0, lowValue, Color.Blue)
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray, Does that go in OnBarUpdate()?
      I put it in there with the proper value's but it didn't draw anything.
      thanks
      JJ

      Comment


        #4
        Yes, in OnBarUpdate()
        RayNinjaTrader Customer Service

        Comment


          #5
          Thanks for the help Ray,


          protectedoverridevoid OnBarUpdate()
          {
          // Use this method for calculating your indicator values. Assign a value to each
          // plot below by replacing 'Close[0]' with your own formula.


          Hi.Set(ValueHi());
          Lo.Set(ValueLo());
          DrawLine(
          "Tag1", 0, ValueHi(), 0, ValueLo(), Color.White);
          }

          Is this enough to plot the line that I asked about in the previous question or do I need to reference that tag somehow?
          thanks
          JJ

          Comment


            #6
            Likely, just try it out and test it.
            RayNinjaTrader Customer Service

            Comment


              #7
              Hey Ray, That peice of code doesn't give me a line. For hi and low value I also just put in a static number to make sure it wasn't my calculations but no go.
              Any suggestions? Do I need anything in Initalize()?
              thanks for the help.

              Comment


                #8
                I will look into it, it should work.
                RayNinjaTrader Customer Service

                Comment


                  #9
                  This works for me:

                  DrawLine("Tag1", 0, High[0] + 4 * TickSize, 0, Low[0] - 4 * TickSize, Color.Red);

                  There is likely something else wrong in your script that you would have to debug.
                  RayNinjaTrader Customer Service

                  Comment


                    #10
                    I appreciate your tiem with me Ray. Your code does work for me but it plots the line on the price panel. I would like the line drawn in the indicator panel. How can I modify that?
                    thanks

                    Comment


                      #11
                      In the Initialize() method, include the following line:

                      DrawOnPricePanel = false;

                      RayNinjaTrader Customer Service

                      Comment


                        #12
                        Awesome Ray! It worked!!!

                        One more dilema for you. How can I get that line to stay and not just paint on the current bar. I'd like it to paint on the current bar of course but I'd also like it to stay when the bar is finished forming if possible.
                        thanks.

                        Comment


                          #13
                          Then you have to provide a unique tag name for each line.

                          Instead of "Tag1"

                          Use something like

                          DrawLine("Tag1" + CurrentBar, 0, High[0] + 4 * TickSize, 0, Low[0] - 4 * TickSize, Color.Red);
                          RayNinjaTrader Customer Service

                          Comment


                            #14
                            Ray, you are the f'n MAN!

                            Got it! I'm very appreciative for your time and expertise.

                            JJ

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by sjsj2732, Yesterday, 04:31 AM
                            0 responses
                            35 views
                            0 likes
                            Last Post sjsj2732  
                            Started by NullPointStrategies, 03-13-2026, 05:17 AM
                            0 responses
                            287 views
                            0 likes
                            Last Post NullPointStrategies  
                            Started by argusthome, 03-08-2026, 10:06 AM
                            0 responses
                            286 views
                            0 likes
                            Last Post argusthome  
                            Started by NabilKhattabi, 03-06-2026, 11:18 AM
                            0 responses
                            133 views
                            1 like
                            Last Post NabilKhattabi  
                            Started by Deep42, 03-06-2026, 12:28 AM
                            0 responses
                            95 views
                            0 likes
                            Last Post Deep42
                            by Deep42
                             
                            Working...
                            X