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 PeakTry, Today, 10:49 AM
    0 responses
    2 views
    0 likes
    Last Post PeakTry
    by PeakTry
     
    Started by llanqui, Today, 10:32 AM
    0 responses
    4 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by StockTrader88, 03-06-2021, 08:58 AM
    45 responses
    3,992 views
    3 likes
    Last Post johntraderuser2  
    Started by TAJTrades, Today, 09:46 AM
    0 responses
    8 views
    0 likes
    Last Post TAJTrades  
    Started by rhyminkevin, Yesterday, 04:58 PM
    5 responses
    62 views
    0 likes
    Last Post dp8282
    by dp8282
     
    Working...
    X