Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Hiding Irrelevant UI Property Grid Items

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

    Hiding Irrelevant UI Property Grid Items

    I have developed a strategy with different user-selectable modes of operation. I would like to programmatically gray-out or remove UI property grid items that are irrelevant to a currently selected mode.

    This code doesn't work because there is no object reference to the non-static TradeBreakouts field, but it shows what I would like to be able to do.
    Code:
            [NinjaScriptProperty]
            [Display(Name = "Trade Breakouts", GroupName="2) Trading Parameters", Order=2)]
            public bool TradeBreakouts
            { get; set; }
    
            [RefreshProperties(RefreshProperties.All)]
            [Browsable(TradeBreakouts)]
            [NinjaScriptProperty]
            [Range(0, double.MaxValue)]
            [Display(Name="Breakout Factor", Description="Breakout entry limit price as a percentage of SD", GroupName="2) Trading Parameters", Order=3)]
            public double BreakoutFactor
            { get; set; }
    Is there a way to get values from NinjaTrader UI's property grid in this context?

    #2
    I thought this might provide the required static reference, but it also doesn't work, so apparently the static reference it provides is to the wrong object.
    Code:
            [NinjaScriptProperty]
            [Display(Name = "Trade Breakouts", GroupName="2) Trading Parameters", Order=2)]
            public bool TradeBreakouts
            { get; set; }
    
            protected static bool tradeBreakouts() {
                return TradeBreakouts;
            }
    
            [RefreshProperties(RefreshProperties.All)]
            [Browsable(tradeBreakouts())]
            [NinjaScriptProperty]
            [Range(0, double.MaxValue)]
            [Display(Name="Breakout Factor", Description="Breakout entry limit price as a percentage of SD", GroupName="2) Trading Parameters", Order=3)]
            public double BreakoutFactor
            { get; set; }

    Comment


      #3
      Hello caveat_lector,

      Thanks for opening the thread.

      Customizing the property grid will involve using TypeConverters.

      You can find an example that demonstrates how they can be used with indicators and strategies below.



      We look forward to being of further assistance.

      Comment


        #4
        Thanks Jim. Exactly what I needed.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        82 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        43 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        64 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        68 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        56 views
        0 likes
        Last Post CarlTrading  
        Working...
        X