Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enum Issue

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

    Enum Issue

    am I doing this right?

    define an enum

    Code:
    namespace myENUM
    {
    public enum tradeType
    {
    Long,
    Short
    }
    }
    define a property

    Code:
    [Display(GroupName = "Parameters", Description = "trading type")]
    public myENUM.tradeType tType
    {
    get { return tType; }
    set { tType = value; }
    }
    initialize

    Code:
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    tType = myEnum.tradeType.Long;
    {
    }
    compiles ok but if I right click my chart and select indicators, it locks up and I have to restart.

    if I remove "tType = myEnum.tradeType.Long" then its ok.

    #2
    Seems OK to me.

    Just a thought ...
    Have you tried exiting and restarting NinjaTrader?

    Comment


      #3
      yes, restarted laptop & NT8 several times

      Comment


        #4
        Hello dibDab,

        You are returning the variable to itself in an endless loop in the getter.

        Try the following instead:
        Code:
        [Display(GroupName = "Parameters", Description = "trading type")]
        public myENUM.tradeType tType
        { get; set; }
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I can add the file if useful

          Last edited by dibDab; 01-12-2024, 10:11 AM.

          Comment


            #6
            Hello dibDab,

            Are you stating my suggestion did not correct the issue?
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            596 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            343 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            556 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            554 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X