Announcement

Collapse
No announcement yet.

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.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    72 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    143 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    76 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    47 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    51 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X