• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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:

    https://i.imgur.com/Uu3jt10.png

    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 TazoTodua; 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:

    https://msdn.microsoft.com/en-us/lib...(v=VS.90).aspx

    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.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by donwtrading, Today, 06:23 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by Johnny Santiago, Today, 04:51 PM
    2 responses
    11 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by nekroart, Today, 04:52 PM
    0 responses
    5 views
    0 likes
    Last Post nekroart  
    Started by otislauwaert, Today, 02:43 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_JoshG  
    Started by Johnny, Today, 02:32 PM
    3 responses
    15 views
    0 likes
    Last Post Johnny
    by Johnny
     
    Working...
    X