Reloading strategy files (.cs)

I’ve had to scrap the former installatio folder and install a fresh NT.

I’ve copied the .cs files to
C:\Program Files\NinjaTrader 8\bin\Custom\Strategies

I’ve done the compile, none show up.

I’ve created a new strategy and copy/pasted to the new strategy. However, the new strategy doesn’t show up either. I looked in the Strategies folder and it’s not there.

Where are the strategy files stored?

Thanks!

Solved it. NT for some reason does not store the .cs file where it should. Rather, for me at least it stores the .cs files in my user folder.

C:\Users\User Name\Documents\NinjaTrader 8\bin\Custom\Strategies\mycustomstrategy.cs

Why is that? How can I change the storage location?

That is the standard location. It’s hard coded and can’t be changed. Storing user documents (ie your custom code files) in the Program Files directory is bad form. Changing files in that folder requires admin permissions and keeping things in the user’s documents allows potential other users to have their own custom files as well.

2 Likes

You’re absolutely right! I really should drop back to regular user mode. Better security.

For me it’s in Documents/NinjaTrader 8/bin/Custom/Strategies/.
Indicators are in their own folder in Custom/Indicators/

Sorry. Didn’t refresh and notice you solved it already.

Also keeping the installation files and user files separate has the advantage that you can install/uninstall/re-install/upgrade the application without messing with user files each time. Each installation will point to the user area and work as intended.

2 Likes

@fc77

UPDATE: Yes. I think I misunderstood your comment.

You’re saying that when NT installs it places some files in the Program Files area and others in the user’s Documents folder.

You weren’t talking about the distinction between the files NT installed in Documents/NinjaTrader 8 and the strategy or indicator files the user creates themselves which get stored in the Custom folder.


Could you offer a few more details on what you mean by:

  • keeping the installation files and user files separate
  • each installation will point to the user area

It’s my understanding that all user created indicators or strategies MUST be under NinjaTrader 8/bin/Custom.

It would be nice if there were a way to have user files completely separate as you describe. Or maybe I’m misunderstanding…

What you stated is correct.

When NT installer installs a new version, everything goes under Program Files. This is where the application binary and other installation related files reside. If it’s your first installation of NT ever, it will also install some startup files under the user directory.

The user directory is under your user profile in Documents/NinjaTrader 8. When you install a new release, I believe there’s minimal change (or possibly no change) to the contents of this directory. This is where all user customizations reside. Even if you decide to entirely remove the application from Windows Add/Remove programs, the user directory won’t be affected. You can later install another version and the new installation will utilize everything that you already built (templates, workspaces, indicators, strategies, etc) from the user directory.

For NT to recognize your custom indicators and strategies (so they can be compiled), they need to show up under bin/Custom as you stated. But they don’t physically need to be there. You can have them in a different directory (or a different drive), but you need to create junctions (symbolic links) under bin/custom to the physical location of the files. As far as I know, this is the only way to get NT to recognize your custom code if it doesn’t physically reside under bin/custom.

Hope this helps.

3 Likes