Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    26 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    32 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, Yesterday, 09:53 PM
    2 responses
    49 views
    0 likes
    Last Post wzgy0920  
    Started by Kensonprib, 04-28-2021, 10:11 AM
    5 responses
    192 views
    0 likes
    Last Post Hasadafa  
    Started by GussJ, 03-04-2020, 03:11 PM
    11 responses
    3,234 views
    0 likes
    Last Post xiinteractive  
    Working...
    X