![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Apr 2010
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
Is there anyway for me to use TimeSpan to return a value for use in a strategy?
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Welcome to our forums - yes, you can use C# TimeSpan's in your NinjaScript code.
http://www.ninjatrader-support2.com/...ad.php?t=19292
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Apr 2010
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
This is what i have so far and It seems to not be returning anything to me.
A little bit of help would go a long way. DateTime startTime = DateTime.Now; tradeTime = DateTime.Now.Subtract(startTime).TotalMilliseconds ; |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
cboat,
Any runtime errors in your Control Center logs?
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Apr 2010
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
Yes I get Error on calling 'OnBarUpdate' methof for strategy 'XXXXX':Object reference not set to an instance of an object.
|
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Your issue is elsewhere in your code then. Please see this tip: http://www.ninjatrader-support2.com/...ead.php?t=4226
You could try using try-catch blocks to isolate which line is causing you the issues too.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Optimizing bool/enum/TimeSpan parameters | -Swig- | Strategy Analyzer | 5 | 12-21-2011 06:58 AM |
| Volume[1] nothing return | Nikoli | Indicator Development | 4 | 03-31-2010 08:10 AM |
| Timespan parameters | sequentur | General Programming | 3 | 11-04-2009 07:54 AM |
| How to return value for indicator? | cowcool | Indicator Development | 9 | 06-01-2009 12:58 PM |
| Return value is zero | billitin | Indicator Development | 3 | 10-14-2008 05:15 PM |