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

Using Statements

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

  • NinjaTrader_PatrickH
    replied
    Hello jg123,

    Thank you for your post.

    What statements are you referring to?

    Some general performance items on NinjaScript can be found below.

    Logging and Printing
    Extremely liberal use of Log() and Print() methods can represent a performance hit on your PC as it takes memory and time to process each one of those method calls. When running custom NinjaScript, especially when using CalculateOnBarClose = false, please be mindful of how often Log() and Print() methods are processed as it can quickly consume PC resources.
    • Log() method should not be used except for critical messages as each log entry makes it to the Control Center log which stays active till the end of the day. Excessive logging can result in huge amounts of memory being allocated just to display all the log messages which would mean less memory for NinjaTrader to do other tasks.
    • Print() method can be used more liberally than the Log() method, but can still represent a performance hit if used with extremely high frequency. Consider decreasing the printing from your script if you experience slowdowns when running the script.

    Debug Mode
    Please also ensure you do not have Debug Mode enabled as it can lead to lower performance. To disable, right mouse click in any NinjaScript Editor and uncheck the "Debug Mode" menu item. After doing so, press F5 to recompile.

    Leave a comment:


  • jg123
    started a topic Using Statements

    Using Statements

    Is there any benefit to leaving the Using statements that are automatically populated by NinjaTrader that are not actively being used within the code?

    I am looking to go through and optimize my code in order to have it as lightweight as possible in order to use only as much processing power as absolutely needed in order to properly run the code.

    What are some common things that people do in order to make their code more streamlined?

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