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


Show code for customers only

  • Filter
  • Time
  • Show
Clear All
new posts

    Show code for customers only

    Friday I wrote to NT Support asking how to protect my code so it shows only to my paying customers. I never received a response.

    I was told by a friend that there is a line of code that can be added so that the indicator checks my database of paid clients that are authorized to use my indicator. Please help me get this information.

    Hello casabella,

    If you have not received an auto-response that your message was received, this may indicate that our support emails are being blocked by firewalls/spam filters. If this is the case please unblock NinjaTrader by adding platformsupport [at] ninjatrader [dot] com to your list of safe senders and also add platformsupport [at] ninjatrader [dot] com as a contact in your address book so we may better assist you.

    Please try sending a new email to platformsupport [at] ninjatrader [dot] com from your personal email. (Instead of sending from the platform)

    You can export your code as an assembly (.dll) to prevent this code from being read or modified, and optionally you can use Agile.NET to prevent the code from being un-assembled (deobfuscated).

    All links below are publicly available.

    If you are exporting the script as an assembly any references to any dll files in NinjaTrader will be included with the exported file. This includes any 3rd party assemblies.
    Or if you are exporting an open source script and this open source script is using a referenced dll, this would also cause NinjaTrader to include references to all dlls with the export including 3rd party assemblies.

    For this reason I suggest you have a separate NinjaTrader 8 folder in (My) Documents that you can use for development that will not have the assemblies that you are using in your trading environment.

    To create a clean temporary NinjaTrader folder:
    1. Shutdown NinjaTrader
    2. Rename (My) Documents\NinjaTrader 8\ to (My) Documents\NinjaTrader 8.original\
    3. Download the NinjaTrader installation package from the link below
    4. Run the repair from this (if the repair is unsuccessful, uninstall and then re-install NinjaTrader)

    This will recreate the NinjaTrader 8 folder in (My) Documents.

    Copy open source script from the original environment from the Custom\<script type>\ folder.
    • (My) Documents\NinjaTrader 8.original\bin\Custom\Indicator

    To the new clean environment
    • (My) Documents\NinjaTrader 8\bin\Custom\Indicator

    Compile the script.
    1. Open NinjaTrader
    2. From the Control Center click the New menu -> select NinjaScript Editor
    3. On the right open a script such the Indicators -> ADL script
    4. Right click in the window and select Compile to compile all scripts
    5. At the bottom of the window a new section will appear where you can find the error locations.
    6. From there you have the option to comment out offending code sections, remove the complete indicator or debug it to be able to compile again.

    Once the script is compiled and there are no compile errors, export the script.
    1. Click Tools -> Export -> NinjaScript...
    2. Optionally, to export a closed source assembly dll check the box labelled 'Export as compiled assembly'
    3. If you have Agile.NET installed and would like to use this, check the box labelled Protect compiled assembly
    4. Click the 'add' link -> check the box(es) for the script(s) you want to include
    5. Click the 'Export' button
    6. Enter a unique name for the file in the value for 'File name:'
    7. Choose a save location -> click Save
    8. Click OK to clear the export location message

    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<>

    Below is a link to the help guide on Exporting NinjaScripts.

    When finished I would recommend undoing all changes and revert back to a clean environment (meaning delete the open source script and remove any references that may have been manually added to prevent compile errors). This will make it easy to save this environment the next time you need to export.

    To switch back to your original environment:
    1. Shutdown NinjaTrader
    2. Rename (My) Documents\NinjaTrader 8 to (My) Documents\NinjaTrader 8.secondary\
    3. Rename (My) Documents\NinjaTrader 8.original to (My) Documents\NinjaTrader 8\
    4. Start NinjaTrader

    Below is a link to the hlep guide on Agile.NET protection.

    You can purchase Agile.NET here. is a best-in-class obfuscator for .NET platform. protects .NET applications against piracy, code theft & malicious tampering.
    Last edited by NinjaTrader_ChelseaB; 10-17-2017, 10:38 AM.
    Chelsea B.NinjaTrader Customer Service


      Yes, I received an auto response but never an answer after 2 business days.


      Latest Posts


      Topics Statistics Last Post
      Started by amousaber, Today, 09:30 AM
      0 responses
      Last Post amousaber  
      Started by suraj, Today, 08:51 AM
      0 responses
      Last Post suraj
      by suraj
      Started by calmcosmia, Yesterday, 03:07 PM
      6 responses
      Last Post karenmkrohn  
      Started by sofortune, 05-16-2024, 11:45 PM
      5 responses
      Last Post sofortune  
      Started by Likomatervy, Today, 05:35 AM
      0 responses
      Last Post Likomatervy