Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TimSpan type not saved with workspace

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

    TimSpan type not saved with workspace

    hi - I have an indicator I am working on where one of it's inputs is a TimeSpan type (see code below). For some reason which I can't figure out, when I save the workspace, the values I set to this parameter are not saved. When I reopen the workspace, the value returns to the initial/default value (00:00:00).

    Other indicator params retain value just fine.

    Any ideas?


    Code:
            private TimeSpan noTradeStart1;
    and the property is defined as this:

    Code:
            [Description("")]
            [GridCategory("Parameters")]
            public TimeSpan NoTradeStartTime1
            {
                get { return noTradeStart1; }
                set { noTradeStart1 = value; }
            }

    #2
    In the indicator window ('ctrl + i' in a chart), when you're configuring or adding the indicator, set the timespan you want to save, right-click on the right-hand side of the window and choose "Set default for 'x'."

    Comment


      #3
      thanks. That saves the defaults for the study and it does work. The problem with that is that it means that I have one set of settings for the study and can't store different settings which is what I expect to have with workspaces. Really need the ability to save these values per workspace.

      Comment


        #4
        Originally posted by onnb1 View Post
        thanks. That saves the defaults for the study and it does work. The problem with that is that it means that I have one set of settings for the study and can't store different settings which is what I expect to have with workspaces. Really need the ability to save these values per workspace.
        You have to serialize the TimeSpan variables correctly. There are many ways to do so. Search the fora for serialize timespan and you should see quite a few examples to choose from.

        Comment

        Latest Posts

        Collapse

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