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

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 benmarkal, Yesterday, 12:52 PM
    3 responses
    22 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by helpwanted, Today, 03:06 AM
    1 response
    17 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    11 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    6 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    244 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Working...
    X