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

making a copy of strategy

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

    making a copy of strategy

    When I right click in the code window to do a save as to make a copy, the save as is grayed out. Any reason it does this or whats another quick way to make a copy.

    Thanks

    #2
    Hello dedouglas,

    The SaveAs should generally always be visible if you have a file open and have clicked in the text area of the file. Are you clicking in the window frame area or somewhere that is not specifically the text area of the file? In that case you would see the save as grayed out, otherwise, I would expect this to be visible.

    Have you also noticed if this happens only in one script, or is this generally happening across all scripts?

    An alternative, until this is figured out, would be to manually copy/paste the file and change its class name. You can open the folder: Documents\NinjaTrader 8\bin\Custom\Indicators, copy and paste the file in question to make a copy. An example is @SMA Copy.cs. Rename the file to MySma.cs. In the NinjaScript editor there will now be errors due to a naming conflict. Open the MySMA.cs and change it from public class SMA to public class MySMA. You additionally need to change the Name= in the State.SetDefaults and provide your own name.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      I am trying to follow instructions in the "NinjaScript Editor 401" YouTube video and am having the same Save As grayed-out problem dedouglas reported above. I tried the alternative solution to manually copy & paste the file that you gave him, but Documents\NinjaTrader 8\bin\Custom\Indicators does not contain a file named SimpleMACrossover.cs even though that file compiles in Strategy Builder and its name appears in and can be selected from the drop-down list on the Create a new Strategy panel in Strategy Builder. If I terminate and restart NinjaTrader the SimpleMACrossover file can still be viewed in Strategy Builder, so it is being saved somewhere, but it is not included with all the other files in the Documents\NinjaTrader 8\bin\Custom\Indicators folder.

      Comment


        #4
        Hello caveat_lector,

        Based on the details it sounds like you have some duplicate strategy made in the builder with a similar name to SampleMACrossOver.

        The SampleMACrossOver that comes with the platform is a manually coded strategy so this will not appear in the builder and cannot be duplicated from the builder. You would need to use the NinjaScript editor specifically to make a copy of this strategy. If you had used the builder to open a file, that would not be the correct process and that also would not be the correct strategy (the one being viewed in the builder). To open the correct strategy you will need to open the New -> NinjaScript editor window.

        The SampleMACrossOver should appear under the strategies folder in the NinjaScript editor with a lock icon. You can double click it to open the code in the editor. In the code view you can then Right click to save as.

        If you instead opened a strategy which was created with the builder to view its code in the Ninja Script editor you cannot use the SaveAs feature from the NinjaScript editor. Strategy builder created scripts can only be duplicated by using the strategy builder and its drop down menu by hovering the mouse over its name to show the save as button.


        I look forward to being of further assistance.




        JesseNinjaTrader Customer Service

        Comment


          #5
          That was the problem. I had opened the file in the Strategy Builder instead of the NinjaScript Editor.

          Thanks for your quick help.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by alifarahani, Today, 09:40 AM
          6 responses
          25 views
          0 likes
          Last Post alifarahani  
          Started by Waxavi, Today, 02:10 AM
          1 response
          17 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by Kaledus, Today, 01:29 PM
          5 responses
          13 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by Waxavi, Today, 02:00 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by gentlebenthebear, Today, 01:30 AM
          3 responses
          17 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X