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.
    JesseNinjaTrader Customer Service

    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 bmartz, 03-12-2024, 06:12 AM
      4 responses
      31 views
      0 likes
      Last Post bmartz
      by bmartz
       
      Started by Aviram Y, Today, 05:29 AM
      4 responses
      12 views
      0 likes
      Last Post Aviram Y  
      Started by algospoke, 04-17-2024, 06:40 PM
      3 responses
      28 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by gentlebenthebear, Today, 01:30 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by cls71, Today, 04:45 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X