Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Property Indentation

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

    Strategy Property Indentation

    I have created a property for my strategy that allows the user the ability to change profit targets. See below pic. I want the two parameters with the red arrows to be indented and allow the user to enter values in them only if "Enable Changing Targets" is checked. Whenever "Enable Changing Targets" is not checked, the user will not have the ability to change values and I want the text to be hidden or grayed out (if possible). How do I do update my code to do this? I included my code below for reference. Thanks

    Click image for larger version  Name:	NinjaIndent.png Views:	15 Size:	5.8 KB ID:	1306140

    HTML Code:
    [NinjaScriptProperty]
            [Display(ResourceType = typeof(Custom.Resource), Name = "Enable Changing Targets", GroupName = "NinjaScriptStrategyParameters", Order = 3)]
            public bool ChangeTarget
            { get; set; }
            
            [NinjaScriptProperty]
            [Display(ResourceType = typeof(Custom.Resource), Name = "# of Ticks within to activate new target", GroupName = "NinjaScriptStrategyParameters", Order = 4)]
            public int TickRang
            { get; set; }
            
            [NinjaScriptProperty]
            [Display(ResourceType = typeof(Custom.Resource), Name = "Enter # of Ticks to set new target", GroupName = "NinjaScriptStrategyParameters", Order = 5)]
            public int NewTickTarget
            { get; set; }​
    Last edited by algospoke; 06-17-2024, 06:29 PM.

    #2
    Hello algospoke,

    Thank you for your post.

    I recommend checking out the following reference sample script:



    This script demonstrates how to toggle if properties are shown/hidden based on a bool checkbox. You may search the script for "use case #1" and jump to different comments and regions of code that are relevant to that use case.

    Please let us know if we may be of further assistance.​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    42 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
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X