Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Adding ENUM type for drop down parameter list compiles but crashes strategy analyzer

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

    Adding ENUM type for drop down parameter list compiles but crashes strategy analyzer

    I was attempting to add a custom ENUM drop down list and followed the example UniversalMovingAverage example I had seen posted in forum. The code compiles fine, but when I try to open the Strategy in strategy analyzer it freezes and then NT8 completely crashes. I think it's something maybe to do with serialization errors, as I see some reference to that in logs.

    I already tried resetting the database as well.

    Here is the code as added in the NinjaProperties Section

    [NinjaScriptProperty]
    [Display(Name="L_MA_Type", Description="Long Trades Choose a Moving Average Type.", Order=11, GroupName = "Parameters")]
    public CustomEnumNamespace.L_UniversalMovingAverage L_MA_Type
    {
    get { return L_MA_Type; }
    set { L_MA_Type = value; }
    }​

    If I comment out this code and anything else that uses this ENUM variable, it compiles and loads in Analyzer just fine.



    Code from declaration
    namespace CustomEnumNamespace
    {
    public enum L_UniversalMovingAverage
    {
    SMA,
    EMA,
    WMA,
    VWMA,
    }
    }​



    Any suggestions? ENUM types are supposed to be serializable by default form what I've read (?) so I'm not sure why not working.

    Thank you,
    Jeremy

    #2
    Hello Jeremy,

    Thanks for your post and welcome to the NinjaTrader Forums!

    Are you defining a private object in your script similar to how the SampleUniversalMovingAverage script does?

    If so, how exactly are you defining the private object in your script?

    Does the behavior occur when selecting the strategy in the Strategy Analyzer? Or, does it occur when trying to save a template for the strategy in the Strategy Analyzer?

    Please share a reduced exported sample script with us that reproduces the behavior along with the steps you are using to reproduce the behavior so that we may investigate the matter further.

    Note that a reduced copy refers to a copy of the script that contains the minimum amount of code needed to reproduce the issue. All other code is commented out or removed.

    To create a copy of your script to modify, open a New > NinjaScript Editor, select your script, right-click in the Editor, select 'Save as', name the script, and click OK.

    To export a script, go to Tools > Export > NinjaScript AddOn.

    ​​​​​​​We look forward to assisting further.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    5 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    13 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,982 views
    3 likes
    Last Post jhudas88  
    Working...
    X