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

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.
      JimNinjaTrader Customer Service

      Comment


        #4
        Thanks Jim. Exactly what I needed.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rocketman7, Today, 02:12 AM
        2 responses
        16 views
        0 likes
        Last Post rocketman7  
        Started by briansaul, Today, 05:31 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by PaulMohn, Today, 03:49 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by frslvr, 04-11-2024, 07:26 AM
        6 responses
        106 views
        1 like
        Last Post NinjaTrader_BrandonH  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        6 responses
        26 views
        0 likes
        Last Post trilliantrader  
        Working...
        X