![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Can I please get an explanation as to what file path this script causes NT to use? My understanding is that it would look for the .txt file in the NinjaTrader 6.5 directory in the "My Documents" folder...if this is incorrect please explain. I thank you in advance.
privatestring path = Cbi.Core.UserDataDir.ToString() + "MyFile.txt"; Basically I need to know if the "Cbi.Core.UserDataDir" is the NinjaTrader 6.5 folder in "My Documents" |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Dec 2004
Location: , ,
Posts: 225
Thanks: 0
Thanked 11 times in 8 posts
|
I am running Vista and this is what I use:
dir = new DirectoryInfo(System.Environment.GetFolderPath(Env ironment.SpecialFolder.MyDocuments)); Print ("AutoNet||Constructor Path:" + dir.ToString() ); My assumption is that if you are running XP that it will also point to the correct directory. |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks scjohn but I get some errors I don't understand when I try your code...let me explain my problem a bit more.
I have an Indicator running on a machine using that code and it runs perfectly. I "exported" the Indicator to use on another machine running NT and now the Indicator doesn't work after I've imported. I believe the problem is because the file the Indicator "searches" for in the "NinjaTrader 6.5" folder of the "My Documents" folder is not found because the different machine has a different name...thus the path for "My Documents" is slightly different. I was trying to confirm if this is the problem or not by attempting to find out what the full path name is that NT is searching, I would have thought it just searches the "My Documents" folder regardless of machine name... |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Dec 2004
Location: , ,
Posts: 225
Thanks: 0
Thanked 11 times in 8 posts
|
Cbi.Core.UserDataDir.ToString() will point you to the NinjaTrader 6.5 directory. Which is a sub directory located in either My Documents or Documents directory depending upon your operating system. Cbi.Core.UserDataDir will have the full path to the NinjaTrader 6.6 directory. So, yes, the full path will more than likely be slightly different on a different machine but you should still end up pointing to the NinjaTrader 6.5 directory. Unless you are modifying that path in your code it is my opinion that the code should work on both machines. It's hard to diagnose this type of problem without looking at the code. Have you check the the log files for errors?
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Thank you for the reply. Yes I looked at the log but there are no errors there. The only thing I see is in the "Output Window" whereby it reports "file does not exist" which is how it is coded to report if in fact the needed file is not found...that is why I posted originally, the file in fact does exist where it should and thus that led me to believe for some reason the path to the file was somehow being read differently on a different machine...
The code has been unmodified from its original state after being imported as well. |
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Burga1,
I suggest you just print the file path directly and see what it is evaluating to.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Thank you, what is the correct format to print the directory path? The following is throwing an error: Print(dir.ToString());
|
|
|
|
|
|
#8 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
You already set it to your string variable. Just print your string.
Print(path);
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the info, that worked well however just leads to a deeper mystery...the path being printed is exactly as it should be. The file is where it should be (in that path), so I now have no clue why the script reports "file does not exist"...
|
|
|
|
|
|
#10 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Please provide complete simple-as-possible code. Thank you.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| TickCounter text location | ssg10 | Indicator Development | 4 | 02-10-2009 01:53 AM |
| Programm NT for Chart Location? | ajtrader | General Programming | 3 | 07-29-2008 06:20 AM |
| Automated Strategy Performance/Co-Location | nolantx | Automated Trading | 3 | 06-03-2008 10:15 PM |
| Physical location of strategies? | adrian | Miscellaneous Support | 2 | 04-13-2008 05:27 PM |
| Any change to dll location? | Folls | Strategy Development | 2 | 01-28-2008 04:56 PM |