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 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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Austiner87, Today, 05:02 PM
    0 responses
    4 views
    0 likes
    Last Post Austiner87  
    Started by tonynt, 05-21-2019, 06:27 AM
    10 responses
    530 views
    1 like
    Last Post fiendtrades  
    Started by awwenzovs, Today, 08:03 AM
    2 responses
    14 views
    0 likes
    Last Post NinjaTrader_Eduardo  
    Started by Ashkam, 04-29-2024, 09:28 AM
    4 responses
    44 views
    0 likes
    Last Post Ashkam
    by Ashkam
     
    Started by nightstalker, Yesterday, 02:05 PM
    1 response
    30 views
    0 likes
    Last Post NinjaTrader_Eduardo  
    Working...
    X