Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Browsable(false) for def indicator property breaks result

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

    Browsable(false) for def indicator property breaks result

    Hi

    I have a very simple indicator for which I want to 'force' the calculation mode to be Calculation.OnPriceChange. To achieve this, used [Browsable(false)] which works fine to hide the property on the indicators panel. But as soon as I hide it, the code weirdly stops working as intended. Somehow any default property that gets hidden goes back to it's default value, in the case of Calculation, it changes to the first const: Calculation.OnBarClose.

    In the State.SetDefaults function Calculation.OnPriceChange is assigned, but when the Property is set to [Browsable(false)] the calculations are made OnBarClose, even though when Printing this.Calculation.ToString() "OnPriceChange" gets printed.

    I have two copies of the indicator, one with, the other without the following piece of code:
    Code:
    [Browsable(false)]
    public Calculate Calculate
    {get; set; }
    The one without that piece of code shows the Calculation property on the Indicators Panel, and works as intended.
    The one with those lines hides the Calculation property, but even when setting the calculation mode to OnPriceChange, the calculations are made OnBarClose.

    Any idea on how this can be solved?

    Any help is appreciated. The indicator is already working fine in every other aspect, but if this can be hidden and the results correct it would be nice.

    Thanks!​
    Last edited by DonMiguelo; 12-28-2024, 10:53 AM. Reason: typo

    #2
    Instead, just put Calculate = Calculate.OnPriceChange; in State == State.Configure. It will still show up in the parameters but will not allow changing.
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    127 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    73 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    115 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    109 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    88 views
    0 likes
    Last Post CarlTrading  
    Working...
    X