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

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 fx.practic, 10-15-2013, 12:53 AM
            5 responses
            5,403 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by Shai Samuel, 07-02-2022, 02:46 PM
            4 responses
            94 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by DJ888, Yesterday, 10:57 PM
            0 responses
            6 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by MacDad, 02-25-2024, 11:48 PM
            7 responses
            158 views
            0 likes
            Last Post loganjarosz123  
            Started by Belfortbucks, Yesterday, 09:29 PM
            0 responses
            8 views
            0 likes
            Last Post Belfortbucks  
            Working...
            X