Cannot find path to NinjaTrader: Fixing NT8 when it's not installed in the default location
Is your NinjaTrader a custom install? Learn how to get CrossTrade to work when NT8 isn't installed in the default location.
UPDATE: We've revised the way CrossTrade looks for the NT directory. As of 7/5/24, the occurrence of this error should be dramatically reduced. If you are still experiencing it, follow the instructions below.
Why am I receiving an error when I open
If it's the first time you've opened CrossTrade, you may come across a critical error in the Activity Log saying it cannot find the path to NinjaTrader, e.g.,
[Jul 01 10:42:42] ERROR (critical): Cannot find path to NinjaTrader in C:\Users\username\Documents
When installing NinjaTrader 8 for the first time, if no modifications are made during the install process, then aside from the application being installed to Program Files the default location for some important configuration files is:
C:\Users\<USERNAME>\Documents\NinjaTrader 8\
CrossTrade is expecting this folder to be there and requires it to run correctly.
But what if it's not there? What if you're running a special install of Windows or have a different Documents structure because of the policies on your machine? Read on to find out what to do about it.
What's so special about this folder and why does CrossTrade need it?
Inside the Documents\NinjaTrader 8 directory is a special folder called "incoming." This folder is used by NT to listen for Order Instruction Files (OIF) to be written. When one of these files shows up, NT will ingest it, parse it, and execute the instructions within.
CrossTrade uses this system to execute your trades when they're sent from TradingView. We interpret the TV alert message, convert it to the order command structure NT is expecting, and write it out to "incoming" folder.
In some rare cases, either the user or the system chooses to create this NT8 file structure in a different location. A common example would be if you have your Windows profile cloud-synced to OneDrive. Upon install NT8 may create this location instead:
C:\Users\<USERNAME>\OneDrive\Documents\NinjaTrader 8\
"NinjaTrader should not be used with OneDrive as you will see file access violations and other issues when OneDrive tries to sync files to the cloud. If you are currently using OneDrive, please redirect your Documents folder to a local hard drive on your PC, then reinstall NinjaTrader."
- NinjaTrader Support (source)
How to fix the error by linking folders
When CrossTrade can't find the incoming directory it's looking for, there are two options: reinstall NinjaTrader, or in lieu of reinstalling, create the folder structure CrossTrade is looking for and link it to where the NT8 files actually exist.
In Windows 10 and 11, you can create a folder that is linked to another folder, such that changes in one are reflected in the other. So in our case, if we write into the folder CrossTrade is expecting, it will be mirrored to the NT8 directory.
This can be achieved using symbolic links or directory junctions. Here’s how you can do it:
Create the folder structure
First, create the default NT8 folder structure that CrossTrade requires. In C:\Users\<USERNAME>\Documents\
if the "NinjaTrader 8" folder doesn't exist, create it.
You should now be able to navigate to:
C:\Users\<USERNAME>\Documents\NinjaTrader 8\incoming\
Option 1: Using Symbolic Links (Symlinks)
A symbolic link is a file-system object that points to another file-system object.
Steps to Create a Symbolic Link:
Open Command Prompt as Administrator:
- Press
Windows + X
and select "Command Prompt (Admin)" or click the Start button and search for cmd.exe, open as Administrator. - Replace
<USERNAME>
with your current Windows username. - Replace
C:\Path\To\TargetFolder
with the path to the target folder that NinjaTrader created during installation.
Use the mklink
command:
mklink /D "C:\Users\<USERNAME>\Documents\NinjaTrader 8\incoming\" "C:\Path\To\TargetFolder"
Option 2: Using Directory Junctions
A directory junction is similar to a symbolic link but is specific to directories and works only within local NTFS file systems.
Steps to Create a Directory Junction:
Open Command Prompt as Administrator:
- Press
Windows + X
and select "Command Prompt (Admin)" or click the Start button and search for cmd.exe, open as Administrator. - Same as above, ensure the directory structure exists and replace
<USERNAME>
with your current Windows username. - Again, replace
C:\Path\To\TargetFolder
with the path to the target folder that NinjaTrader created during installation.
Use the mklink
command with the /J
option:
mklink /J "C:\Users\<USERNAME>\Documents\NinjaTrader\incoming" "C:\Path\To\TargetFolder"
Examples
If your username is "joseph," you know NT8 was installed into your OneDrive Documents directory, and you want to link C:\Users\joseph\Documents\NinjaTrader 8\incoming
to C:\Users\joseph\OneDrive\Documents\NinjaTrader 8\incoming
, you would use the following command:
mklink /D "C:\Users\joseph\Documents\NinjaTrader 8\incoming" "C:\Users\joseph\OneDrive\Documents\NinjaTrader 8\incoming"
or for a directory junction:
mklink /J "C:\Users\joseph\Documents\NinjaTrader 8\incoming" "C:\Users\joseph\OneDrive\Documents\NinjaTrader 8\incoming"
Points to Note:
- Symlinks: These can point to files or directories, and they can link to network locations. They require administrator privileges to create.
- Junctions: These can only point to directories on local volumes and do not require administrator privileges to follow, but they do require administrator privileges to create.
By using either symbolic links or directory junctions, you can create a folder that mirrors another folder, ensuring that changes in one are reflected in the other.
FAQs
When using the mklink
command, I get the error "Cannot create a file when that file already exists" - what should I do?
This happens when Windows wants to create the \incoming directory itself used for the link. Manually remove the incoming directory and run the mklink
command again. Here's a command to help (don't forget to change "joseph" to your username first):
rmdir /S "C:\Users\joseph\Documents\NinjaTrader 8\incoming"