Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Editor blowing up all the things! [BUG]

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

    Editor blowing up all the things! [BUG]

    I had this problem before but it seems to be happening more and more and as my codebase grows, it's especially frustrating.

    The problem is that the NinjaScript Editor expands EVERY SINGLE class, method, and #region that is collapsed. That means I have to go back through all 2k lines of code and recollapse the 30 different areas.

    I can reproduce this by:

    1. Create a new strategy and immediately choosing Generate.
    2. Delete all lines of code.
    3. Copy-paste the code below into that new strategy.
    4. Collapse the following areas with the '-' minus sign:
    • Line 76 myClass1
    • Line 74 #region My Classes
    • Line 69 OnBarUpdate
    • Line 39 OnStateChange

    5. Now, within #region My Methods is public void TestMe()
    {
    Type string, or int, or even a comment // and watch what happens.
    }
    6. All the other regions expand as well as OnBarUpdate and OnStateChange.

    I'm on Win10 Home 1703 / build 15063.483 and NT 8.0.8.0 64-bit (Standard)

    Can anyone else confirm this?

    I found that it happens less if the method/class you're working on isn't within a region but it's not guaranteed to stop the behavior.

    Code:
    #region Using declarations
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Input;
    using System.Windows.Media;
    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.Indicators;
    using NinjaTrader.NinjaScript.DrawingTools;
    #endregion
    
    //This namespace holds Strategies in this folder and is required. Do not change it. 
    namespace NinjaTrader.NinjaScript.Strategies
    {
    	public class MyCustomStrategy : Strategy
    	{
    		#region My Methods
    		
    		public void TestMe()
    		{
    			
    		}
    		
    		#endregion
    
    		protected override void OnStateChange()
    		{
    			if (State == State.SetDefaults)
    			{
    				Description									= @"Enter the description for your new custom Strategy here.";
    				Name										= "MyCustomStrategy";
    				Calculate									= Calculate.OnBarClose;
    				EntriesPerDirection							= 1;
    				EntryHandling								= EntryHandling.AllEntries;
    				IsExitOnSessionCloseStrategy				= true;
    				ExitOnSessionCloseSeconds					= 30;
    				IsFillLimitOnTouch							= false;
    				MaximumBarsLookBack							= MaximumBarsLookBack.TwoHundredFiftySix;
    				OrderFillResolution							= OrderFillResolution.Standard;
    				Slippage									= 0;
    				StartBehavior								= StartBehavior.WaitUntilFlat;
    				TimeInForce									= TimeInForce.Gtc;
    				TraceOrders									= false;
    				RealtimeErrorHandling						= RealtimeErrorHandling.StopCancelClose;
    				StopTargetHandling							= StopTargetHandling.PerEntryExecution;
    				BarsRequiredToTrade							= 20;
    				// Disable this property for performance gains in Strategy Analyzer optimizations
    				// See the Help Guide for additional information
    				IsInstantiatedOnEachOptimizationIteration	= true;
    			}
    			else if (State == State.Configure)
    			{
    			}
    		}
    
    		protected override void OnBarUpdate()
    		{
    			//Add your custom strategy logic here.
    		}
    		
    		#region My Classes
    		
    		public class myClass1
    		{
    			
    		}
    		
    		#endregion
    	}
    }
    Last edited by hillborne; 08-02-2017, 11:27 PM. Reason: New information

    #2
    Hello hillborne,

    Thanks for opening the thread.

    I am able to see the same behavior and I have passed this on for further investigation. I will update this post with more information as it becomes available.

    EDIT: This is logged as a known issue with the ActiPro technology that the NinjaScript Editor is built upon. We are monitoring advancements in this underlying technology but we cannot make any immediate changes to fix the issue.

    Thank you for reporting!
    Last edited by NinjaTrader_Jim; 08-10-2017, 02:51 PM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by hillborne View Post
      I had this problem before but it seems to be happening more and more and as my codebase grows, it's especially frustrating.

      The problem is that the NinjaScript Editor expands EVERY SINGLE class, method, and #region that is collapsed. That means I have to go back through all 2k lines of code and recollapse the 30 different areas.

      I can reproduce this by:

      1. Create a new strategy and immediately choosing Generate.
      2. Delete all lines of code.
      3. Copy-paste the code below into that new strategy.
      4. Collapse the following areas with the '-' minus sign:
      • Line 76 myClass1
      • Line 74 #region My Classes
      • Line 69 OnBarUpdate
      • Line 39 OnStateChange

      5. Now, within #region My Methods is public void TestMe()
      {
      Type string, or int, or even a comment // and watch what happens.
      }
      6. All the other regions expand as well as OnBarUpdate and OnStateChange.

      I'm on Win10 Home 1703 / build 15063.483 and NT 8.0.8.0 64-bit (Standard)

      Can anyone else confirm this?
      I have had similar experiences using the wizard. Its great to start off a strategy but seems to get "boogered" up when adding more than 10 rule sets, or adding date logic. I also dont think its OS specific, I tried from a Win 10 VM, as well as my Windows7 machine. It could be made a little easier for those of us that want to start with a wizard, then add additional custom logic in once everything else is operational.
      Last edited by GrnGold; 09-03-2017, 10:50 AM.

      Comment


        #4
        I have been developing NinjaScript but do it all using a version of Emacs editor in a side application. (Am using Codewright with my own extensions this is pre-2000).

        The internal NT editor picks up changes and compiles as files are updated. Visual Studio 2015 can also be setup to automatically reload and compile changed files (have some custom UserControl projects build external as well used by my AddOns).

        So what I'm saying is consider using a better editor external to NT itself. SlickEdit is one a lot of people use. The NT editor might be a little slow but it will see changes and recompile.

        Think outside da box!

        (IDE editors are always inferior, IMHO, to something like Emacs.)

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        17 views
        0 likes
        Last Post helpwanted  
        Started by ScottWalsh, Today, 06:52 PM
        2 responses
        17 views
        0 likes
        Last Post ScottWalsh  
        Started by cre8able, Today, 07:24 PM
        0 responses
        1 view
        0 likes
        Last Post cre8able  
        Started by Haiasi, Today, 06:53 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ScottW, Today, 06:09 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X