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

Creating a standalone "Custom" folder

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

    Creating a standalone "Custom" folder

    Trying to find a way to move all of my strategy and indicator development under a standalone "Custom" folder in order to manage that development with source code management. (git)

    Is this possible?
    Last edited by RandyT; 07-20-2018, 03:46 PM. Reason: Make title more accurate.

    #2
    Hello RandyT,

    Thank you for your note.

    This would not be possible in NinjaTrader however you could copy your NinjaTrader files to a new custom folder which your git app references, however you would have to copy paste these files back over to ninjatrader for the changes to be reflected.

    I will submit a feature request for this.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Just to make sure I understand your suggestion, you are suggesting that I should maintain the files in git, and then copy them to the existing Custom folder in order to update the platform?

      If that is your suggestion, it is a bit rough but might be made to work...

      It would be super helpful if even a requirement to edit a registry entry to add another Custom folder to an import list would accomplish the goal.

      I've depended on source code management for too many years. It is hard not to have that fallback and associated tools.

      Comment


        #4
        Hello Randy,

        You can put folders inside the indicator folder and put your scripts in there. Would this work for you?

        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Hello RandyT,

          Yes, that was the suggestion, the files would need to be inside of the bin/custom folder in the appropriate folder for the platform to compile them. The only alternative would be to compile your code into a DLL and reference the DLL like a third party import. You can use visual studio to compile NinjaScript code into a dll which that code would reside outside of the bin/custom folder. This process does require the platform to restart to reload the DLL to see changes, so this would not be advisable for development and only for a release.

          As far as Source control goes, that is outside of what our support can provide assistance with. You are free to use source control programs as you need, how you accomplish backing up the data would be up to you and how you find works for your goals. If you use GIT, you could potentially use a .gitignore file to only commit what you need in that project. You could also use Alan's suggestion for subfolders. Additionally, You could also search online for advance source control use and filtering for more ideas.

          Please let me know if I may be of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #6
            I've been going round and round on that topic here: https://ninjatrader.com/support/foru...d.php?t=111207

            From what I am finding, it at least requires the following layout. It is not possible to just have one folder that I could checkout within the Custom folder:

            Code:
            Addons
                         - myAddons
            Indicators
                         - myIndicators
            Strategies
                         - myStrategies
            Not ideal, but might be workable if some of the issues I am running into with partial classes in Strategies worked. I'm currently working on a different approach that is working for me in AddOns which does require an object reference to use these methods but at least works. The challenge seems to be with putting a partial class in a subfolder (which may very well be my lack of knowledge on the inheritance topic).

            Comment


              #7
              Hello RandyT,

              Rather than have 2 people working on the issue I suggest you follow the advice of Jesse who is the best resource on the topic.

              Thank you.
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                Alan,

                I created this separate thread since I believe it to be different than the issue that Jesse was helping me with. Thanks to Jesse's persistence, that other issue is resolved.

                In the interest of contributing back, on the topic of setting up git managed Custom directory, I wanted to share the following steps that I have taken to get this working in case someone else finds it helpful. This is not intended as a tutorial on how to use git source code management. Just a few notes on what it takes to get it working for NinjaTrader code management.

                1. Download git for Windows from https://gitforwindows.org/

                2. Recommend installing with the bash terminal, especially if you are familiar with Unix/Linux environment.

                3. Configure your name and email address for git
                Run

                git config --global user.email "[email protected]"
                git config --global user.name "Your Name"

                to set your account's default identity.
                4. Replicate the folder layout you would like to use for your own local Indicator, AddOn and Strategy development. Something like the following:

                cd $HOME/Documents/NinjaTrader 8/bin/Custom
                mkdir -Path AddOns/myAddOns
                mkdir -Path indicators/myIndicators
                mkdir -Path Strategies/myStrategies
                5. Create or move any NinjaScript code that you want to put under your own git source code management into the respective folders shown above.

                6.
                cd $HOME/<random temp folder>
                mkdir -Path AddOns/myAddOns
                mkdir -Path indicators/myIndicators
                mkdir -Path Strategies/myStrategies
                7. Copy any of the Ninjascript files that you relocated into personal folders in step #5 into this temporary file layout.
                cp $HOME/Documents/NinjaTrader 8/bin/Custom/AddOns/myAddons/*.cs ./AddOns/myAddOns/
                cp $HOME/Documents/NinjaTrader 8/bin/Custom/AddOns/myAddons/*.cs ./Indicators/myIndicators/
                cp $HOME/Documents/NinjaTrader 8/bin/Custom/AddOns/myAddons/*.cs ./Strategies/myStrategies/
                8. This step assumes that you have a remote git repository that you have created a clean repo to store your NT files.
                git init
                git add .
                git commit -m "first commit"
                git remote add origin ssh://[email protected]/mygithub/myNTrepo.git
                git push -u origin master
                9. With the following steps, since it is not easy to clone this partial set of files into an existing NT Custom folder, the following steps work around the challenge.
                git clone sh://[email protected]/mygithub/myNTrepo.git
                cd myNTrepo
                mv .git $HOME/Documents/NinjaTrader 8/bin/Custom/
                10. Now change to the Ninjatrader Custom folder
                cd $HOME/Documents/NinjaTrader 8/bin/Custom
                11. Edit a file named `.gitignore` and put the following contents in that file.
                de-DE
                es-ES
                fr-FR
                obj
                pt-PT
                ru-RU
                zh-Hans
                *.resx
                *.dll
                *.csproj
                AssemblyInfo.cs
                NinjaTrader.Vendor.cs
                Resource.Designer.cs
                ResourceEnumConverter.cs
                ExportNinjaScript/
                Indicators/*.cs
                Indicators/TG/
                Strategies/*.cs
                AddOns/*.cs
                @*.cs
                12. Run `git status` and look for output.
                $ git status
                On branch master
                Your branch is up to date with 'origin/master'.

                nothing to commit, working tree clean
                13. If you see the above output, then you are set. git will track source code changes for you. If you see other output identifying untracked files, you may need to add patterns to the `.gitignore` to exclude them from management.

                Hope someone finds this useful.

                Comment


                  #9
                  Hello RandyT,

                  Thank you for sharing this with the forum.
                  Alan P.NinjaTrader Customer Service

                  Comment


                    #10
                    Looking forward to trying your suggestions Randy.

                    Comment


                      #11
                      so nobody here has any problem with trying to get .gitignore to ignore NinjaTrader.Custom*.dll files? I tried naming them explicity in .gitignore, *.dll, and variations with wildcards in the name... can't get any of them to work. But I can ignore other files, it leads me to believe that there is some problem with the way these files are named... but if I'm the only one having this problem (both with git on VS and VS Code) then I really don't understand what is going on... can anyone send some insight? I'm no git configuration expert.

                      Comment


                        #12
                        Originally posted by NinjaCustomer View Post
                        so nobody here has any problem with trying to get .gitignore to ignore NinjaTrader.Custom*.dll files? I tried naming them explicity in .gitignore, *.dll, and variations with wildcards in the name... can't get any of them to work. But I can ignore other files, it leads me to believe that there is some problem with the way these files are named... but if I'm the only one having this problem (both with git on VS and VS Code) then I really don't understand what is going on... can anyone send some insight? I'm no git configuration expert.
                        Here is what I have in my .gitignore. Works as expected.

                        Code:
                        .vs/
                        *.resx
                        *.dll
                        *.csproj
                        *.xml
                        AssemblyInfo.cs
                        NinjaTrader.Vendor.cs
                        NinjaTrader.Custom.sln
                        NinjaTrader.Custom.*
                        Resource.Designer.cs
                        ResourceEnumConverter.cs
                        ExportNinjaScript/
                        Indicators/*.cs
                        Indicators/TG/
                        Strategies/*.cs
                        AddOns/*.cs
                        BarsTypes/*.cs
                        @*.cs

                        Comment


                          #13
                          thanks Randy, I figured it out finally - I had accidentally committed some dlls originally. So I committed their deletions and all is well now. You have some useful ignores there - I'll add them to mine.

                          Comment


                            #14
                            Randy, thanks so much. I think I have it working, and this saved me a ton of time; not to mention possible code losses into the future. Much appreciated.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by maybeimnotrader, Today, 05:46 PM
                            0 responses
                            5 views
                            0 likes
                            Last Post maybeimnotrader  
                            Started by quantismo, Today, 05:13 PM
                            0 responses
                            6 views
                            0 likes
                            Last Post quantismo  
                            Started by AttiM, 02-14-2024, 05:20 PM
                            8 responses
                            166 views
                            0 likes
                            Last Post jeronymite  
                            Started by cre8able, Today, 04:22 PM
                            0 responses
                            8 views
                            0 likes
                            Last Post cre8able  
                            Started by RichStudent, Today, 04:21 PM
                            0 responses
                            5 views
                            0 likes
                            Last Post RichStudent  
                            Working...
                            X