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 selu72, Today, 02:01 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Zachary  
    Started by WHICKED, Today, 02:02 PM
    2 responses
    11 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Started by f.saeidi, Today, 12:14 PM
    8 responses
    21 views
    0 likes
    Last Post f.saeidi  
    Started by Mikey_, 03-23-2024, 05:59 PM
    3 responses
    51 views
    0 likes
    Last Post Sam2515
    by Sam2515
     
    Started by Russ Moreland, Today, 12:54 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Erick  
    Working...
    X