Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plots vertical line

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

    Plots vertical line

    Hello everybody.
    I need to implement 2 vertical lines to determine the start date and the end of the data sample. In what methods should I revise them, and how can I then contact them to get the data of the time. Which method should work when dragging lines and releasing the mouse button to redraw the indicator. If there are examples or links I will be grateful.
    Thank you.

    #2
    Hello Arkaiy_B,

    To trigger an action at a specific time, you can add your action to OnBarUpdate in the action block of a condition that checks the Time series using the barsAgo index of the bar.


    Use ToTime if you want to ignore the date.


    To draw a vertical line as the action use Draw.VerticalLine().


    For example:
    Code:
    if (ToTime(Time[0]) == 90000))
    {
    Draw.VerticalLine(this, "line1", 0, Brushes.Blue);
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi NinjaTrader_ChelseaB.
      I did not ask about that. The OnBarUpdate method works when the bar is closed or at each tick. I need to catch the event when I drag the vertical line. How to draw a vertical line, I also understand, I need to understand where to insert this function, State == State.DataLoaded it does not appear.

      Comment


        #4
        Originally posted by Arkaiy_B View Post
        I need to catch the event when I drag the vertical line. How to draw a vertical line, I also understand, I need to understand where to insert this function, State == State.DataLoaded it does not appear.
        I've used an OnRender() override to populate a dictionary of DrawingTool anchor SlotIndex values.

        Comment


          #5
          Hi Arkaiy_B,

          When you mention "I need to implement 2 vertical lines to determine the start date and the end of the data sample. In what methods should I revise them, and how can I then contact them to get the data of the time." are you not trying to draw two vertical lines based on a start date and end date from bar data?

          There is not a method that is triggered when the time or price value of a drawing tool anchor is changed.

          However, tradesmart is correct, OnRender() will trigger anytime you touch the chart with the mouse. If you move a drawing object this would trigger OnRender() but would not be specific to that drawing object.


          You could loop through all drawing objects and compare the anchors current values with saved values to see if they have changed.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          595 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
          554 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X