NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 06-24-2012, 05:12 PM   #1
onnb1
Member
 
Join Date: Sep 2011
Posts: 79
Thanks: 40
Thanked 2 times in 2 posts
Default 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; }
        }
onnb1 is offline  
Reply With Quote
Old 06-24-2012, 05:26 PM   #2
Radical
Senior Member
 
Join Date: Sep 2008
Posts: 543
Thanks: 80
Thanked 187 times in 131 posts
Default

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'."
Radical is offline  
Reply With Quote
Old 06-24-2012, 05:32 PM   #3
onnb1
Member
 
Join Date: Sep 2011
Posts: 79
Thanks: 40
Thanked 2 times in 2 posts
Default

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.
onnb1 is offline  
Reply With Quote
Old 06-24-2012, 07:02 PM   #4
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,199
Thanks: 24
Thanked 1,225 times in 996 posts
Send a message via Skype™ to koganam
Default

Quote:
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.
koganam is offline  
Reply With Quote
The following 3 users say thank you to koganam for this post:
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strategy settings saved in workspace.xml? cassb Miscellaneous Support 4 03-19-2012 07:38 AM
type of price (last/bid/ask) saved from realtime data SARdynamite Miscellaneous Support 9 03-22-2011 09:05 AM
Workspace opening charts in saved time ascending order laurus12 Charting 4 08-02-2010 06:19 PM
Default workspace never gets saved maxpi Miscellaneous Support 3 05-03-2009 04:27 AM
Losing saved chart workspace Drew Charting 1 05-16-2007 07:03 AM


All times are GMT -6. The time now is 02:21 AM.