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

how to clear/clean/remove all RenderTarget items

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

    how to clear/clean/remove all RenderTarget items

    Hi.
    inside OnRender, I draw different objects by i.e. `RenderTarget.DrawLine` ,`RenderTarget.DrawTextLayout` etc...

    however, on each script change/update, I get the duplicated items drawn (seems, the previous drawings are not removed).

    shortly, how to make the OnRender function, to clean/remove all previous execution's drawn items?
    (the same result when I remove indicator from chart and re-attach again, then it draws items on clean chart... i want the same to happen on each OnRender re-execution)
    Last edited by ttodua; 12-05-2017, 05:07 AM.

    #2
    Hello,

    Thank you for the post.

    OnRender is not like the drawing tools where you have a Tagging system, there is no cleanup of the lines needed. The only cleanup you would need to do would be resources like your TextLayout would need to be disposed of, but that would not draw a duplicate line on the next pass if you had not disposed of it.

    When OnRender is called, it is run from top to bottom to supply the platform with render information. That is used when the chart is repainted. There is no caching of this information so when your logic says to draw a line that happens or when your logic stops saying to draw that line, it would no longer be drawn or visible.

    Based on your comments, it sounds like whatever logic you are using to do the drawing is also duplicating the lines. Are you currently using conditions to draw the lines and then store information to variables or file? In short, we would need more information on the logic you are using to understand why that is being duplicated. If you have a simple example that demonstrates the duplication, we could review that together to see why that is happening.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bill2023, Yesterday, 08:51 AM
    8 responses
    43 views
    0 likes
    Last Post bill2023  
    Started by yertle, Today, 08:38 AM
    6 responses
    25 views
    0 likes
    Last Post ryjoga
    by ryjoga
     
    Started by algospoke, Yesterday, 06:40 PM
    2 responses
    24 views
    0 likes
    Last Post algospoke  
    Started by ghoul, Today, 06:02 PM
    3 responses
    16 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    46 views
    0 likes
    Last Post jeronymite  
    Working...
    X