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 compile CS files

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

    How to compile CS files

    When somebody shares their ninjascript file how do I compile that as an indicator? I have a file with some code which I have copied to the ninjascript editor and managed to compile without any errors. The problem is that it does not show up in my list of indicators on any of my charts. It does show up in the ninjascript explorer though (under indicators).

    #2
    Hello Grantx,

    Thanks for your post.

    We recommend using our import/export process to distribute NinjaScripts to be sure that all dependencies are included, to avoid confusion, and to prevent situations where the NinjaTrader Documents folder gets damaged.

    Import - https://ninjatrader.com/support/help...nt8/import.htm

    Export - https://ninjatrader.com/support/help...nt8/export.htm

    NinjaScripts will have three different names.

    1. The Filename, which will be seen in the NinjaScript Editor
    2. The Class name, which makes the script unique on your platform
    3. The Name property, which is set in OnStateChange under State.SetDefaults. This name will be seen in the Indicators dialog.

    If you do not see the indicator's name (Name property) in the Indicators dialog, I suggest checking the Log tab of the Control Center for any errors involving the indicator. If the indicator hits a run time error before it is listed, it will not be listed.

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      the file has a .CS extension and I have copied the text into a new indicator file. I go to the ninjascript editor and select new indicator.
      Then I copy the entire contents into the new script and compile with no errors.
      I name the file. I can see the file in ninjascript but not from the chart.
      I deliberately create an error and the compilation tells me there is an error. When I remove the error it compiles just fine. Where is it compiling to? Am I missing a step?

      Comment


        #4
        Hello Grantx,

        All NinjaScripts in source code are compiled into the Documents\NinjaTrader 8\bin\Custom\NinjaTrader.Custom.dll file. You are not missing a step and just need to know what the name is that you should be looking for.

        If the script compiles, check for the Name as entered for the Name property under OnStateChange > State.SetDefaults. This will be the name listed in the Indicators dialog. Check any subfolders in the Indicators dialog as well.

        If you do not see the indicator listed, please check the log tab of the Control Center for runtime errors and inform the developer.

        If you are stuck here, I may suggest reaching out to the developer of the indicator so they can give you an export of the indicator and let you know what name you should be looking for. You can then import it following the steps linked in post #2.

        If you want to learn more about NinjaScript code, I recommend starting with the Strategy Builder 301 course and NinjaScript Editor 401 course.

        Strategy Builder 301 — https://www.youtube.com/watch?v=HCyt90GAs9k

        NinjaScript Editor 401 — https://www.youtube.com/watch?v=K8v_2ONBbqI

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          Found it. Thank you very much indeed Jim.

          Comment


            #6
            Hi there, I'm a couple of steps behind here - someone has sent me a .cs file, which I believe is a strategy. How do I import this (it's not a Zip file), and also, when I've imported it, can I still use Strategy Builder to add further entry conditions?

            Thanks
            Attached Files

            Comment


              #7
              Hello TradingAssassin,

              The file that you attached is a strategy and it has been unlocked so you won't be able to edit it in the builder. The strategy also references an indicator named TDUMarketStructure so that would need to be imported before you can manually import this file. If you have that indicator you can place the .cs file in the folder: Documents\NinjaTrader 8\bin\Custom\Strategies. After putting the file in that folder you need to open the NinjaScript editor and right click -> Compile or press F5 to compile.
              JesseNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by JonesJoker, 04-22-2024, 12:23 PM
              8 responses
              41 views
              0 likes
              Last Post JonesJoker  
              Started by timko, Today, 06:45 AM
              0 responses
              3 views
              0 likes
              Last Post timko
              by timko
               
              Started by Waxavi, 04-19-2024, 02:10 AM
              2 responses
              38 views
              0 likes
              Last Post poeds
              by poeds
               
              Started by chbruno, Yesterday, 04:10 PM
              1 response
              44 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by Max238, Today, 01:28 AM
              1 response
              25 views
              0 likes
              Last Post CactusMan  
              Working...
              X