Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bug in NT8 export

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

    Bug in NT8 export

    Hi.
    this attached file is exported file from nt.
    however, seems NT exports it incorrectly, because during import, we get these messages:



    on those lines (in exported .cs file), I see such mistaked codes:

    line 34:
    Code:
    private VolumeRatiosBonus.LiveNewsBroadCast_namespace3{.LiveNewsBroadCast[] cacheLiveNewsBroadCast;



    the original source of indicator (that seems to cause the problem), is like:


    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Globalization;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Xml;
    using System.Xml.Serialization;
    
    using NinjaTrader.Cbi;
    using NinjaTrader.Gui;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Gui.SuperDom;
    using NinjaTrader.Gui.Tools;
    using NinjaTrader.Data;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.Core.FloatingPoint;
    using NinjaTrader.NinjaScript.DrawingTools;
    using System.Drawing;
    
    using SharpDX.Direct2D1;
    using SharpDX;
    using SharpDX.DirectWrite;
    using System.Net.Http;
    using System.Collections.Specialized;
    using System.Reflection; 
     
    using NinjaTrader.NinjaScript.Indicators.VolumeRatiosBonus.LiveNewsBroadCast_my_namespace;  
    
    namespace NinjaTrader.NinjaScript.Indicators.VolumeRatiosBonus.LiveNewsBroadCast_my_namespace{
    	#region NewsImpact Enum
    	public enum NewsImpact	
    	{
    	    Unknown = 0,
    	    Error 	= 1
    	}
    	#endregion
    }
    
    
    namespace NinjaTrader.NinjaScript.Indicators.VolumeRatiosBonus
    {
    	public class LiveNewsBroadCast : Indicator
    	{
    
    		
    		//.......
    	}
    }
    if i put space between "LiveNewsBroadCast_my_namespace" and "{", then another error appears (in bottom auto-generated code:



    i have met the problem quite frequently, when i declare and use "using" command with embeded helper namespaces, in case i use them like:

    Code:
    VolumeRatiosBonus.LiveNewsBroadCast_my_namespace;
    instead of

    Code:
    NinjaTrader.NinjaScript.Indicators.VolumeRatiosBonus.LiveNewsBroadCast_my_namespace;
    obviously , compiler uses some imperfect methods, and it needs to be fixed.


    if i move `namespace NinjaTrader.NinjaScript.Indicators.VolumeRatiosBon us.LiveNewsBroadCast_my_namespace{` declaration (line) below the main indicator namespace block, then problem is completely fixed and everything does as it should work (even export is ok).
    Attached Files
    Last edited by ttodua; 04-13-2018, 12:31 PM.

    #2
    Hello. Thank you for the post.

    Using a fully qualified namespace will give scope to whatever namespace you are calling from. You can use a namespace alias to help make the code less verbose:



    I'm not sure if I have the full context here, but it looks like you are trying to access something from an external namespace and do not give the fully qualified name, then you will run into scoping issues.

    Legal:

    Code:
    namespace MainNS
    {
    
            namespace SubNS
            {
                    class MyClass;
            }
    
            class MainClass
            {
                   SubNS.MyClass myNewClass;
            }
    
    }
    Not legal:

    Code:
    namespace NS1
    {
        namespace MyClassNS
        {
            class MyClass {}
        }
    }
    
    namespace MainNS
    {
        using NS1;
        class MainClass
        {
            MyClassNS.MyClass myNewClass;
        }
    }
    If you want to do this in the way the second sample demonstrates, then make a namespace alias to fully qualify the type.

    Please let us know if we may be of any further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    43 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Working...
    X