Thanks in advance.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
NinjaTrader.Indicator is a namespace but is used as a type
Collapse
X
-
NinjaTrader.Indicator is a namespace but is used as a type
My @Strategy.cs all of a sudden started throwing this compile error and I cannot for the life of resolve it. Can someone please help on how to fix this? I replace the file with a brand new copy, but it keeps coming back. I am lost.
Thanks in advance.Tags: None
-
Hello amilanoski,
Thanks for your post.
It is a general indication something is wrong with some code, likely of an indicator.
Please follow the instructions below to see where the errors are coming from after compiling the indicator. This will allow you to debug the indicator/strategy or remove it from your PC. If you are wondering why you receive an error when compiling only one indicator, it is because NinjaTrader always compiles all indicators and strategies - not just one. This is done to give you the highest runtime performance possible.- Open NinjaTrader
- From the Control Center select the New menu--> select NinjaScript Editor
- Double click on the Indicators folder--> then double click on any of the indicators
- Once the indicator code is in view right click in the window and select Compile to compile all NinjaScript objects
- At the bottom of the NinjaScript Editor window, a new section will appear where you can find the error locations
- You can exclude the file referenced in the editor by double clicking on the appropriate object type on the right of the NinjaScript Editor window. This will expand the object type folder. You can then select the file with a left click--> right click on the object--> then select Open to begin debugging the file, Exclude From Compilation, or Remove to delete the file.
-
Comment
-
-
Hello amilanoski,
Thanks for your reply.
The @Strategy file appears correct so the likely suspect would be a custom Indicator that is not generating the "NS code wrapper" that a strategy would use. IE the code that start with this line: #region NinjaScript generated code. Neither change nor remove.
If you have recently imported or modified an indicator, I would suggest going through the Ninjascript explorer window and right mouse click on recently imported or recently modified indicator and right mouse click on the indicator file and select "exclude from compilation". when you do that the system will recompile and if that clears the error then you have found the source file of the issue.
Comment
-
i have in a different case error cause by namespace as well, was told to remove an instance of xxxx.base from all places after placing a reference in Using at the top of indicator
which i did, but the only instance i found after that to remove xxxx.base was the actual line that say "namespace xxxx.Base
can you have "namespace" without anything next to it
thanks
this indicator is in a folder when i look for the indicators in the script editor - i have been told that could have something todo with the issue
i saved as a new name and removed the reference to the folder, i now appears when a ad to a chart as normal, but remains in the folder in the script editor
HOW TO I GET IT OUT OF THE FOLDER
Last edited by DTSSTS; 10-27-2021, 10:07 PM.
Comment
-
Hello DTSSTS,
Thanks for your post.
"HOW TO I GET IT OUT OF THE FOLDER". In the Ninjascript editor window, on the ninjascripot explorer window, open the folder, left click on the file and drag the file out of the folder and let go. This will move the file out of the folder and will remove the reference to the folder and recompile the indicator.
When you put a script in a folder, it changes the "Namespace" to include the folder. For example, the following is from an indicator called SettlementLines that is within the folder Settlement:
namespace NinjaTrader.NinjaScript.Indicators.Settlement
{
public class SettlementLines : Indicator
When I drag that file out of the settlement folder, this is what gets changed:
namespace NinjaTrader.NinjaScript.Indicators
{
public class SettlementLines : Indicator
Comment
-
I was hoping to get this to compile in a strategy builder, a forum shows change part of the code and it working, but I have had no success
I did move to regular indicator folder and copy .cs files into that folder, then removed the ones from compilation in the folders as well, with that the compile error instead of the error of xxx.base showing up I now only have the error of the namespace is used like a type, same as last night
I DID GO THRU THE INDICATORS ONE BY ONE from compilation but the only revert between this error and the one where the xxx.base has errors
the suggestiion in the forum that is suppose to fix this was removing all xxx.base in the strategy, but of course that has to be unlocked, and i am not at that point yet on the strategy, like to get as much done in NOT unlocked mode first
I am just going to wait a few days see if my programmer can debug the entire indicator
thanks
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
593 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
343 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
556 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
554 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment