Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Property of Indicators.

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

    Property of Indicators.

    Hi. In the indicator, I enter a property of several variables. How to save settings? It is necessary that after each change of properties of value kept. When we call the indicator, the last settings were set automatically. How can do it?

    In code I have.

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    TimeSeconds = 500;
    Ask_ = Brushes.Tomato;
    }

    [NinjaScriptProperty]
    [Range(1, int.MaxValue)]
    [Display(Name="Time MilliSeconds Dom", Description="Time.", Order=1, GroupName="1. Parameters")]
    public int TimeSeconds
    { get; set; }

    [NinjaScriptProperty]
    [Display(Name = "Ask", Description = "Grid.", Order = 1, GroupName = "2. Color")]
    public System.Windows.Media.Brush Ask_
    { get; set; }

    What should I add in code to save the settings after each property change?

    Thank you very much.

    #2
    Hello _Roman,

    The Brush will need to be serialized so the value may be stored as a string in the xml file for the workspace or the template.

    Below is a link to the help guide.


    The int, however does not need serialization as it naturally converts to a string, and will automatically be saved in xml files.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    43 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    26 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    163 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    98 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    158 views
    2 likes
    Last Post CaptainJack  
    Working...
    X