Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Most effective way to re-draw lines.

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

    Most effective way to re-draw lines.

    Hello everybody,

    I am using DrawLine function in order to add lines to my chart. As the time passing and ticks changed(OnBarClose= false), i'm adding new lines and overwrite the older ones (by calling DrawLine with the same tag but different "X" values) with longer lines at the same y values. my problem is that when i have to update around 20 lines per bar it takes too long(like 7 minutes for update every second frame time chart, for the past 60 days).

    Is there any better effective way to overwrite lines with the same values, but to longer ones?

    Thank you!
    Lior.

    #2
    Hello Lior_Lamesh,

    Thanks for your post and welcome to the forums!

    If the Y values remain the same, would it make sense to just use DrawRays, or DrawHorizontalline at the beginning bar and allowing them to project? These lines, once drawn one time would remain until you needed to change them and would save considerable processing time.



    If your lines change at the begin/end of a session you can add code to detect session begin and adjust/recalculate as needed, however this would erase the historical lines and i'm not sure if that is a concern for you. If it is, another approach would be to use plots to output the lines similar to how pivot point lines are created. Example of pivot point indicators can be found in the file sharing area: http://ninjatrader.com/support/forum/local_links.php
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      I get it.

      Thank you Paul,

      I was looking for creating an infinity lines starts from a certain time, until i want to remove it.
      DrawHorizontalline was good advice but i didn't want the line to be drawn before the certain time i want to. So i used DrawRay - whose let me decide when i want to start drawing.

      Thank you again.
      Lior.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by gentlebenthebear, Today, 01:30 AM
      2 responses
      13 views
      0 likes
      Last Post gentlebenthebear  
      Started by Kaledus, Today, 01:29 PM
      2 responses
      7 views
      0 likes
      Last Post Kaledus
      by Kaledus
       
      Started by frankthearm, Yesterday, 09:08 AM
      13 responses
      45 views
      0 likes
      Last Post frankthearm  
      Started by PaulMohn, Today, 12:36 PM
      2 responses
      16 views
      0 likes
      Last Post PaulMohn  
      Started by Conceptzx, 10-11-2022, 06:38 AM
      2 responses
      56 views
      0 likes
      Last Post PhillT
      by PhillT
       
      Working...
      X