Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Save data programmatically

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

    Save data programmatically

    Hi,

    Is it possible to save data within an indicator programmatically? I want to persistently save some state information (not price data).

    Regards,

    #2
    Hello Halmix,

    Yes that is possible, generally a Public property would be used to save something.

    Would this be a value that the user configures or is this a value the script calculates while it runs?

    I look forward to being of further assistance.

    Comment


      #3
      The value is calculated by the script while it runs.

      Comment


        #4
        Hello Halmix,

        Thank you for the reply.

        For a calculated value you would need to save that yourself, the most simple way would be to write that data to file and then re load it once the script starts. We have a couple of examples of writing and reading data which you can find here:




        I look forward to being of further assistance.

        Comment


          #5
          Is it possible to overwrite and save user properties programmatically instead? Or can these properties only be persistently changed using the user interface?

          Comment


            #6
            Hello Halmix,

            You could technically use a user input for this for a simple type like an int or a bool however that will show up as a selection when you apply the script. If you don't mind that you can just make a standard NinjaScriptProperty:

            [NinjaScriptProperty]
            [Display(Name="Test", Order=1, GroupName="Parameters")]
            public int TestInt
            { get; set; }

            That would be saved with the workspace/templates and through F5 reloads so it could become difficult to track its value depending on what the value needs to be or when it needs set.

            I look forward to being of further assistance.

            Comment


              #7
              Thanks a lot.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              647 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              369 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              572 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X