• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.

            https://marketplace.visualstudio.com...-Visual-Studio

            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 priceisking, Today, 12:51 PM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by chartish, Today, 10:33 AM
            3 responses
            18 views
            0 likes
            Last Post chartish  
            Started by casabella, Today, 11:51 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by Johnny, Today, 11:42 AM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_Jermaine  
            Started by habibalex, Today, 09:03 AM
            2 responses
            14 views
            0 likes
            Last Post sledge
            by sledge
             
            Working...
            X