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 start creating strategy in Visual Studio form the scratch?

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

    How to start creating strategy in Visual Studio form the scratch?

    Hello.
    For years I created strategies in NT editor and used VS as the very convenient debugger.

    And now I need to create the strategy in the Visual Studio form the very begin.
    I searched over the forum but did not find step-by-step instruction.
    I reviewed the AddOn Development Overview and reviewed, of course, Visual Studio Solution for AddOn Development.
    But it do not add any clarity.

    What type of project should I create? Should it be just a blank Solution?
    How to get access to NT classes?
    Should I attach to NT or not?
    How to create the strategy?
    How to compile?
    How to run the strategy in NT? I read VS can palace *.dll into Custom folder, and can it place *.cs file with strategy in Strategies folder?

    I would highly appreciate step-by-step instruction.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hello fx.practic,

    Thank you for the post.

    The reason you did not find a step by step guide for this is that using visual studio is not a documented part of NinjaScript. The help content you linked to assumes you have a good understanding of visual studio already and can use it without any help or instruction. Our support cannot provide assistance for learning visual studio so that is something you will need to review in external resources if the concepts used are not clear.

    What type of project should I create? Should it be just a blank Solution?
    You would use specifically what is shown in the addon visual studio sample, you would use exactly that setup. If you are trying to create a new solution you can use the existing one as reference when making a new solution. A dll in visual studio is called a library so starting with a library would be the first step. You can research this in external C#/Visual studio specific tutorials.

    How to get access to NT classes?
    The visual studio solution shows how to access the NinjaTrader objects however that solution is not intended for creating anything other than Addons. A strategy would not have the correct assemblies referenced in that project.

    Should I attach to NT or not?
    If you are trying to build a dll from visual studio you would need to use visual studio to build it rather than attaching to NinjaTrader. Attaching is for debugging purposes. If you are not clear on the various tools/processes in visual studio I would suggest reviewing the Microsoft guides/information surrounding visual studio before continuing further.

    How to create the strategy?
    As noted I have no suggestion for this type of development in the external visual studio solution. "Strategy" is part of the Custom project (your normal ninjascript files) which would need referenced, however that may cause conflicts in this use case. I really couldn't provide any direction for that type of development in contrast to this external solution.

    How to compile?
    You can find the compile options in the build menu. If you are not certain how to use visual studio to compile or do other tasks you will need to research visual studio and how it is used from Microsoft documentation.

    How to run the strategy in NT? I read VS can palace *.dll into Custom folder, and can it place *.cs file with strategy in Strategies folder?
    When you build the addon from visual studio it will produce only a .dll file and that will be copied to the user folder. That will be loaded at runtime so you will need to build from visual studio while NinjaTrader is exited and then start NinjaTrader. Once the dll is loaded the addon would appear in the menu. As noted we have no design suggestion for strategies in that use case so that would not be something I can comment on how it could be loaded.



    Please let me know if I may be of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you, Jesse.
      That's helpful.
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment


        #4
        Here is my current way out. Maybe, it helps to anyone.

        A friend gave me example VS project for the indicator.
        I've just copy a strategy code (Ctrl+A) and replaced indicator code totally.
        And it worked fine: compiling, building, dll placing at bin\custom\ folder, NT starting automatically.

        I assume, I could use AddOn as template.
        fx.practic
        NinjaTrader Ecosystem Vendor - fx.practic

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DavidHP, Today, 07:56 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by kujista, Today, 06:23 AM
        3 responses
        6 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by Mindset, Yesterday, 02:04 AM
        2 responses
        17 views
        0 likes
        Last Post NinjaTrader_RyanS  
        Started by f.saeidi, Today, 08:03 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by samish18, 04-17-2024, 08:57 AM
        15 responses
        52 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X