Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Data (property) saving/loading

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

    Data (property) saving/loading

    Hello,

    i dont now how to ask this question correctly. I would like to save data to file when i close NT, and load when i run strategy again. Of course I could write my own code, or the below mentioned example would be good as well:

    I would like to save the last value of MaxDrawDown. I create MaxDD indicator class and store here the value, and attributes of a property will be set like that:
    Code:
    [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
    and will not use [XmlIgnore()] attribute. In this case if close NT and save workspace, theoretically it will save the value of property to xml file of workspace. And restart NT, NT will open my workspace and load automatically the saved value, in this case value of MaxDD.

    Could it be a correct solution, instead of writing own code?

    #2
    Originally posted by tamas View Post
    Could it be a correct solution, instead of writing own code?
    Yes ,

    i did it, it works in my sample. When it loads the workspace, datas are loaded as well.

    One more question: am i right when i use [Browsable(false)] attribute and not use [XmlIgnore()] then xml serialization (to myworkspace.xml) dont work? Can i use it together or none of them?

    Thanks in advance

    Comment


      #3
      These properties work independendly, Tamas. Using [Browsable(false)] exclusively (without XmlIgnore) would save and restore that property with the workspace interface.

      Regards
      Ralph

      Comment


        #4
        Originally posted by Ralph View Post
        These properties work independendly, Tamas. Using [Browsable(false)] exclusively (without XmlIgnore) would save and restore that property with the workspace interface.
        Thanks Raplh, i tought the same that it works independetly, yesterday it trow alert window "Indicator 'NinjaTrader.Indicator.AWMaxDD' could not be serialized. Please refer help for more information on serializing indicators.", thats why i asked, but now it works. I dont know what happened yesterday ...

        Comment


          #5
          I think your problem is related to the data type of AWMaxDD. C# automatically serialises only simple data types like string, int, double, etc. Complex types like Color, structures or classes have to be serialised by the user.

          Regards
          Ralph

          Comment


            #6
            Originally posted by Ralph View Post
            I think your problem is related to the data type of AWMaxDD. C# automatically serialises only simple data types like string, int, double, etc. Complex types like Color, structures or classes have to be serialised by the user.
            thank you Ralph

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            580 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            335 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            102 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X