Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Does this save resources

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

    Does this save resources

    I found this snippet in some code produced by NinjaTrader.
    It effectively allows the user to limit the number of Drawings/Plots the indicator does eg last 10
    or show all of them (99)

    marker_Count ++;
    if(Number_Of_Markers != 99 && Number_Of_Markers <= marker_Count)
    marker_Count = 1;//reset ie once it hits marker_Count it reuses the tag so limiting your number of plots

    Draw.Text(this,"Tag"+(Number_Of_Markers == 99 ? CurrentBar: marker_Count),......

    My question is does it really save resources?
    I like it and it makes sense but I am only an intermediate level coder so it would be nice to know if
    it's really useful.

    thank you

    #2
    Hello Mindset,

    Thanks for your post.

    Drawing fewer objects would is more efficient and save resources compared to drawing a large number of objects on a chart.

    Reusing tag names for a drawing object causes that specific drawing object to be updated. If you are looping through 100 tag names, it would limit the script to 100 new draw objects before the first object would be re-used.

    Note that a tag name cannot be reused for a different object type. For example, a tag for a Line drawing cannot be used for a Rectangle drawing.

    Please let me know if I may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    630 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    566 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X