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

Visual Studio and the C# API tutorial

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

    Visual Studio and the C# API tutorial


    I installed Ninja Trader

    NinjaTrader offers exclusive software for futures trading. With our modern trading platform, you will control every step of your trading journey. Open account to trade futures with us!



    is there a tutorial on how to use Visual Studio and the C# API ?

    thanks


    #2
    Hello pvnpvn,

    When using NinjaTrader to create NinjaScript files visual studio is not required but it can optionally be used. The built in NinjaScript editor can be used for all development tasks. When using visual studio it is mainly just used as a text editor, you can open files to edit them and save the file, the NinjaScript editor still needs to be open as it does the actual compiling of the code. The NinjaScript editor is also required to create new files, visual studio cannot be used to generate new NinjaScript files.

    To help clarify, NinjaTrader compiles C# code and executes it inside the platform. NinjaScript is the name of the API framework used to create content in the platform.

    The NinjaScript API documentation can be found here: https://ninjatrader.com/support/help...erence_wip.htm

    Learning visual studio or C# is not something our support can provide help with but you can use Microsofts education portal or other online resources to learn about visual studio or C# language.

    Here is a public website that shows general C# education items: https://www.w3schools.com/cs/index.php

    NinjaTrader uses specifically .net WPF Desktop framework C# 4.8, there are many other versions of .net like .netcore or .netstandard which are not applicable to NinjaScript.

    A good way to find tutorials for learning C# is to use google and search for the topic you wanted to learn, for example "C# if statements"


    If you do want to use visual studio you would need to open the NinjaScript editor and then click the VS button in the toolbar. That will launch visual studio and you can use visual studios file browser to open files. After editing files you only need to save the file, no compiling or building is done inside of visual studio.

    Visual studio can also be used to step through code by attaching to the NinjaTrader process, that is outlined in the following document: https://ninjatrader.com/support/help...=visual+studio

    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse

      What I did so far was to copy this folder

      C:\Users\USERNAME\OneDrive\Documents\NinjaTrader 8\bin\Custom

      with a Visual Studio solution generated by NinjaTrader, and open it

      I can compile it as a library

      Wondering if I can plug a C# "main" here and run it ?

      The goal is to develop C# code that I can plug in into NJ charts

      It seems this is possible from inside NJ, I will take a look at the links

      thanks

      Comment


        #4
        Hello pvnpvn,

        That would not be correct, you need to leave the C:\Users\USERNAME\OneDrive\Documents\NinjaTrader 8\bin\Custom where it is. That is how NinjaScript works inside NinjaTrader, this will not be useable in a different solution.

        All you need to do is open the NinjaScript editor to start creating items.

        Please see the following webinar that covers using the NinjaScript editor: https://youtu.be/H7aDpWoWUQs

        I would not suggest using visual studio until you have a firm grasp on how to use the NinjaScript editor and how items are created/used. Visual studio is not used in any capacity to create files or compile code, that is simply an alternate text editor when using it with NinjaTrader. You also have to click the VS toolbar button to open the solution, the steps you listed won't work to create new items.
        JesseNinjaTrader Customer Service

        Comment


          #5
          ok , got it. thanks

          Comment


            #6
            Hello pvnpvn,

            As a side note I see that you are using onedrive for your documents folder. NinjaTrader does not work well with onedrive enabled, that can cause file duplication and also prevent the platform from working correctly. Any windows application which syncs or accesses the documents folder while NinjaTrader is running may damage your installation.

            I have included a link outlining how to remap your Documents folder below.



            I would also recommend going through OneDrive to make sure OneDrive isn't set to continue to backup the Documents folder. Please see the following link that outlines how to make changes in OneDrive:
            OneDrive is a free online storage that comes with your Microsoft account. Files you store online can be synced across all your Windows devices. However, you don't need to sync ...


            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by algospoke, Yesterday, 06:40 PM
            2 responses
            19 views
            0 likes
            Last Post algospoke  
            Started by ghoul, Today, 06:02 PM
            3 responses
            14 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            45 views
            0 likes
            Last Post jeronymite  
            Started by Barry Milan, Yesterday, 10:35 PM
            7 responses
            20 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by AttiM, 02-14-2024, 05:20 PM
            10 responses
            181 views
            0 likes
            Last Post jeronymite  
            Working...
            X