Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

"stopped working" msg when click indicator menu

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

    "stopped working" msg when click indicator menu

    I have built a few indis for NT8. I have built numerous for NT7.

    For the past few hours I have been working on building an NT8 indicator - doing numerous updates, compiles and then tests of that indi without issue.

    Then out of the nowhere, on my last update, compile, test loop, when I click on the load indicator menu from chart I get the "Ninjatrader has stopped working" dialog and then the application closes.

    I am using the 64 bit version on Windows 10

    how do I resolve this?

    UPDATE:
    I restarted windows - did not resolve
    I opened indi code in editor - recompiled, no error on compile - did not resolve issue

    I then made copy of my indi source that was in ...\NinjaTrader 8\bin\Custom\Indicators
    I then removed that indi using the ninjscript editor
    this made it so I could once again open the indi dialog in the chart

    I then obtained a backup copy of my indi that was working earlier today.
    I copied it back into the ...\NinjaTrader 8\bin\Custom\Indicators folder
    it automatically complied

    I am back to working with my indi in the listing of available indi


    SOLUTION
    seems to be a coding issue on my part.....


    I defined an enum outside the namespace

    public enum VolumeProfileBarRange
    {
    All,
    Visable,
    BarsBack
    }


    in the code I used the following variable def

    VolumeProfileBarRange profilerange = VolumeProfileBarRange.All;

    Notice the lower case "p" on profilerange

    in the properties section I maintained using the lower case "p", this is what caused the error

    when I used an Upper case P (like an example I found using enums in properties parameters) the issue went away


    This code DID NOT work...but complies without error or warning

    [NinjaScriptProperty]
    [Display(Name="Bar Range", Description="Use ALL bars of chart, only visable bars, or use the defined bars back", Order=6, GroupName = "Properties")]
    public VolumeProfileBarRange profilerange
    {
    get { return profilerange; }
    set { profilerange = value; }
    }


    notice the lower case "p" for profilerange in the def

    public VolumeProfileBarRange profilerange



    this code WORKED, changing that "p" to a "P"

    [NinjaScriptProperty]
    [Display(Name="Bar Range", Description="Use ALL bars of chart, only visable bars, or use the defined bars back", Order=6, GroupName = "Properties")]
    public VolumeProfileBarRange Profilerange
    {
    get { return profilerange; }
    set { profilerange = value; }
    }



    maybe this will help someone in future....seems weird to me that this would causes NT8 to abort on indi load from chart menu
    Last edited by tulanch; 10-31-2016, 10:02 PM.

    #2
    Thanks for posting.

    The code you implemented creates a recursive call which results in a StackOverflowException. These sorts of exceptions cannot be caught by the .NET runtime and consequently we have no way to prevent the situation. The same behavior was true going back to early NT versions (6, 7, etc).

    Code:
    [B][COLOR=Red]code below will crash ninjatrader
    
    [/COLOR][/B]        public int CustomProperty
            {
                get { return [COLOR=Red]CustomProperty[/COLOR]; }       // recursive call to CustomProperty property
                set { [COLOR=Red]CustomProperty [/COLOR]= value; }     // recursive call both should be "customProperty "
            }
    MatthewNinjaTrader Product Management

    Comment


      #3
      makes sense, thanks for reply

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by algospoke, Yesterday, 06:40 PM
      2 responses
      18 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      44 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      20 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      180 views
      0 likes
      Last Post jeronymite  
      Working...
      X