Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Clean up help

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

    Indicator Clean up help



    i've coded this indicatro with AI, it does its job fine, but after maybe 10 minutes it causes a noticeable lag for my chart which goes away every time i refresh

    i had another version of this i coded that didnt cause this... honestly i'm not quite sure what's causing it because i don't know how to code

    could anyone help me with cleaning this up?

    i'd also rather use lines than rectangles, but i can't get AI to properly draw lines no matter how much information i give it or examples from other indicators. Always end up with a dashstyle helper issue or something similar
    Last edited by imjustkaze; 12-19-2024, 12:23 PM.

    #2
    Hello imjustkaze,

    Please note, a basic understanding of C# programming is prerequisite to writing NinjaScript code.

    Below is a link to a support article with helpful resources on getting started with C# and NinjaScript.


    The performance impact may be caused by a large number of drawing objects.

    From the help guide:
    "When using Draw methods, a new instance of the Draw object is created including its custom rendering and calculation logic. These methods are convenient in many situations, but can quickly introduce performance issues if used too liberally. In some situations, you may see better performance for rendering via SharpDX in OnRender()."
    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


    Custom rendering the rectangles in OnRender() may alleviate the performance impact.
    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


    Included with NinjaTrader is the SampleCustomRender indicator which shows the basics of custom rendering.

    I'm also including a link to an example of re-using brushes which can also decrease the performance impact.



    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea!

      Comment


        #4
        Originally posted by imjustkaze View Post

        i've coded this indicatro with AI, it does its job fine, but after maybe 10 minutes it causes a noticeable lag for my chart which goes away every time i refresh

        i had another version of this i coded that didnt cause this... honestly i'm not quite sure what's causing it because i don't know how to code

        could anyone help me with cleaning this up?

        i'd also rather use lines than rectangles, but i can't get AI to properly draw lines no matter how much information i give it to learn more or examples from other indicators. Always end up with a dashstyle helper issue or something similar
        Sorry for bumping, it sounds like your indicator might be creating too many objects or not properly cleaning up unused ones, which can cause lag. Try optimizing your code by limiting unnecessary redraws or reusing objects. For switching to lines, review examples of createLine or similar functions in your platform's documentation and ensure you're managing them efficiently to avoid helper issues.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X