Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

auto generated code not recognising Indicators namespace

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

    auto generated code not recognising Indicators namespace

    Hi,
    the auto generated code at the bottom of NinjaTrader 8 indicator is not recognizing that I have moved an indicator to a custom namespace.
    For example :

    //This namespace holds Indicators in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Indicators.QUM
    {
    public class myCoolIndicator : Indicator
    {
    etc

    Adding the .QUM and doing a SaveAs should see the auto generated code recognise that the indicator now belongs in that QUM namespace, but it is not doing that. This feature seems unreliable. How can I FORCE IT to acknowledge the namespace of the indicator? Manually making the changes doesn't work, because Ninja just overwrites it again wrongly.

    Thanks,
    saltminer

    #2
    Sometimes there are errors that are arising when you try to compile unfinished work in a sub folder, it may have issues calling a secondary data set or indie when in another folder not native to the directory. Try copy pasting the entire code into a brand new indie, and make sure that file created is, in this case, in just the root indicators dir.

    Comment


      #3
      Hello saltminer,

      Save As won't update the indicators code, you need to compile for that to be regenerated. I would suggest to delete the generated code from the indicator and then re compile to have it regenerated.

      This also may relate to how you put the indicator into the folder, if you manually changed the indicator namespace that won't work. You would need to have first had the indicator in the normal indicator folder and then use the NinjaScript editor to drag the indicator into the folder. If you used any other process that will cause problems.

      Comment


        #4
        Thanks Jesse,
        I did not know about the dragging within the NinjaScript Editor trick. However, that still doesn't work in this case. I think the issue is a bug with this feature to do with 'using' statements. If I add a "using mynamespace" into this indicator, or even into a blank new indicator, the auto-generated code forgets its sub-namespace and reverts to NinjaTrader.NinjaScript.Indicators and then of course does not compile properly.UNLESS this extra namespace (containing enums etc) is AFTER the entire indicator code body. I believe this is in the guidance and I had not seen behaviour as to why it was required. Now I know. Thanks.

        saltminer
        Last edited by saltminer; 09-13-2022, 01:41 PM.

        Comment


          #5
          Hello saltminer,

          I am not sure what you are referring to with the using statements, I am able to see an indicator being dragged into the folder work successfully. If you are doing something custom you would have to provide a sample + steps for us to test it.

          Keep in mind using custom using statements is not suggested, we never suggest using them if you are referencing your own custom code. You should be using the fully qualified namespace wherever you use that namespace.

          private MyCustomNamespace.MyCustomType myVariableName;

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          646 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          367 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          107 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          569 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X