Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to know if compiling for Script Export

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

    How to know if compiling for Script Export

    I am using the secure plugin to handle the security of my Ninja Script and it is being compiled down into a single CS file and some DLLs.

    My question is if there is a #define that I could use #if statments in the code to know whether my code is being compiled due to an F5 hit - or if its being compiled for an export.

    In my case there are certain debug fields that I'd like to enable when running locally in development mode - but when I compile it for distribution, I'd really not have to remember to turn those off - if I could have something like:

    #if SECURE_COMPILE

    then that would help developers flow when releasing code - Is this possible? and if not - can that be added as a feature request?

    #2
    Hello,

    Thank you for the question.

    I do not believe this would be possible as what you are referring to would be a Preprocessor Directives. NinjaTrader does not have any custom directives nor do I believe you could add them if you wanted to. This is not something NinjaTrader its self has any control over, this is part of the C# compiler.

    Learn the different C# preprocessor directives that control conditional compilation, warnings, nullable analysis, and more


    You can review what is available and see if you could make anything work with those options. Unfortunately I do not believe there is any way to add more to what already exists there, likely the best/most simple solution would be to know you are either running it locally or exporting it and adjust a bool variable in the script accordingly.

    debugMode = false/true;

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    133 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    75 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    117 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    113 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    90 views
    0 likes
    Last Post CarlTrading  
    Working...
    X