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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    633 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    567 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X