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

Programmatically backup scripts

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

    Programmatically backup scripts

    Hi,
    I realized a trading strategy using several indicators, strategy and addons combined. With many object to backup it is clumsy to be obliged to manually select all of them (even though only one has been updated) to proceed and have a consistent backup file. Is there a way to automate the backup process? Thanks for help.

    #2
    Hello afoschini,

    Thanks for your post.

    You can schedule backups when creating a backup, but you will be prompted on the schedule set.

    If you want to automate this more, you could create an AddOn that automatically copies parts of the NinjaTrader 8 folder in the Documents folder to a new location. If you would like to make this a NinjaTrader compatible backup, you will have to create an Info.xml file, zip up the folder and rename it so it has a file extension of ".nt8bk" NinjaTrader backup files are renamed zip files. I would suggest making some small backups and examining the created .nt8bk file so you can better understand what needs to be included.

    AddOn windows will check OnWindowCreated for the Control Center to hook in a menu item on the Control Center. You could use this to start a timer that will then schedule your automatic back up. This should then copy the necessary files and build the back up so it is identical to one that you can export from NinjaTrader.

    Much of this task will be general C# programming and not specifically NinjaScript code. If you would like to reference a sample AddOn for using OnWindowCreated, you can reference the sample AddOn linked below.

    Basic AddOn example linked within - https://ninjatrader.com/support/help...t_overview.htm

    An external resource for creating zip files in C# can be found here - https://stackoverflow.com/questions/...io-compression

    If you have any other NinjaTrader or NinjaScript related inquiries, please don't hesitate to ask.
    JimNinjaTrader Customer Service

    Comment


      #3
      Not backup per se, but the way I handle this for my NinjaTrader development and customization is to put everything in a git repo so that I can go back and recover different versions of what I have developed. It also allows me to move easily between my main trading machine and my laptop when I travel.

      Gary.

      Comment


        #4
        What about an external drive that comes with backup software?

        Comment


          #5
          Automated back up software may be an applicable approach, but I would recommend leaving historical data and log & trace out since these files could be accessed constantly be NinjaTrader and could create File Access Violations that we see when using NinjaTrader with syncing software like OneDrive. These file access violations would ultimately be the circumstances you would need to prepare for in your own back up solution.

          Let me know if there is any other perspective I can share.
          JimNinjaTrader Customer Service

          Comment


            #6
            If you're using Visual Studio, there is a handy VS Plugin called "LocalHistory for Visual studio" that automatically makes a copy of every file every time it changes. You can view all the historical versions of each file.

            Extension for Visual Studio - Local History for Visual Studio automatically creates a copy everytime you save a file.


            You can also use Visual Studio Team Services to check your code into a secure, private source control repo. Set this up via the Team Explorer tab (see screenshot).

            I use both of these. Mostly the VSTS Source control, but LocalHistory has come in very handy too for getting back code that wasn't checked in.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by GussJ, 03-04-2020, 03:11 PM
            14 responses
            3,244 views
            0 likes
            Last Post GussJ
            by GussJ
             
            Started by ArkansasClint, Today, 09:28 AM
            0 responses
            0 views
            0 likes
            Last Post ArkansasClint  
            Started by lorem, Today, 09:18 AM
            1 response
            3 views
            0 likes
            Last Post lorem
            by lorem
             
            Started by hazylizard, Today, 08:38 AM
            4 responses
            11 views
            0 likes
            Last Post hazylizard  
            Started by geddyisodin, Today, 05:20 AM
            2 responses
            20 views
            0 likes
            Last Post geddyisodin  
            Working...
            X