Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-option drop down parameters

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

    Multi-option drop down parameters

    How do i specify multiple options with drop down/combo box type parameter?

    Similar to EntryHandling parameter.

    #2
    This can be done by declaring an enum within your strategy. If you are not familiar with this C# concept I would suggest leaving it for now. This is outside of what we support however, I will provide sample code on how this can be done in the near future.
    RayNinjaTrader Customer Service

    Comment


      #3
      Excellent, I'm familiar with it.

      heres an example for anyone else
      Code:
      public enum PosTypes {Long, Short} // be sure to make this public
      
      PosTypes posType = PosTypes.Long;
      
              [Description("Pos Type")]
              [Category("Parameters")]
              public PosTypes PosType
              {
                  get { return posType; }
                  set { posType = value }
              }

      Comment


        #4
        FYI: There already is an equivalent NT enum: NinjaTrader.Cbi.MarketPosition.

        Comment


          #5
          I know, bad example on my part, i just pulled it out of thin air.

          Comment


            #6
            Originally posted by NinjaTrader_Dierk View Post
            FYI: There already is an equivalent NT enum: NinjaTrader.Cbi.MarketPosition.
            Hm, that's interesting. Is there also such a class for relational operators? (<,>,>=,etc)

            I was just wondering, because I'm making an indicator, and would like to include a drop-down menu with various relational operators so that the user can choose how the condition should be tested. For example with such an drop-down menu it would be possible for the user to choose between 'Variable1 > Variable2' condition and the 'Variable1 < Variable2' condition.

            How can I achieve such a feature with enums? (or perhaps a different way?)

            Any thoughts are highly appreciated

            Regards,

            Comment


              #7
              J_o_s, I'm not aware of one for relational operators, I would suggest you create an enum case for either scenario you would need to express your potential conditions.

              Comment

              Latest Posts

              Collapse

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