Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding new Indicator/Strategy from VS

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

    Adding new Indicator/Strategy from VS

    Hello,

    I know we can create a new strategy/indicator in NinjaTrader and then open it in Visual Studio to make updates.

    Is it possible to add a class to Indicators/Strategy to Visual Studio directly with assumption it would automatically show up/ get compiled in NinjaTrader? Or do I always have to create script in NinjaTrader first?

    p.s. Sorry, just realized I posted thread in the wrong forum - can it be moved to general NT8 discussions?

    Thanks

    #2
    Hello,

    Thank you for the question.

    This can be done using VS, either editing or creating new files. One problem with creating new files is that you would be asked to reload the VS project as soon as NT compiles because of the file being added into the .csproj.

    If you create a file, click Overwrite when prompted the new class should appear in the solution explorer as included in the project.

    for editing, as long as the NinjaScript editor is open all changes should be detected, if it is closed you would need to compile later.

    I look forward to being of further assistance.

    Comment


      #3
      One trick I've been using when creating new files in VS is to use Save All to save the file and project. You won't be prompted to reload the project in this case because VS would have updated it already. You have to do Save All really quickly after creating the new file (before NT compiles) for this to work - this applies if you are renaming a file as well.

      One issue I have when creating indicator files in VS is that the VS file is not updated with the NT generated code (even in B6). If you open the file in a NinjaScript window and make a modification (like space, backspace) and compile, VS will then update. I think if you close the file in the editor and re-open it will fix it as well. I'm not sure if it's only when the generated code is missing or if it also happens when there is a change that requires the generated code to change (like adding a new public ninjascript property).

      BEWARE: I've spent quite a bit of time when debugging trying to figure out why the breakpoint is disabled and says "The source is different". This happens when VS is not updated with the generated code.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X