![]() |
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: Feb 2009
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
How can my script detetct whether it runs in live trading or in replay resp. back testing mode?
For real time trading I have set time restrictions like Code:
if ( (alsoOutsideRegularHours == false && ToTime(DateTime.Now) >= eStartTime && ToTime(DateTime.Now) < eStopTime) || (alsoOutsideRegularHours == true) ) entryTimeOK = true; else entryTimeOK = false; Code:
if ( (alsoOutsideRegularHours == false && ToTime(Time[0]) > ToTime( 9, 30, 0) && ToTime(Time[0]) <= ToTime(14, 50, 0)) || (alsoOutsideRegularHours == true) ) entryTimeOK = true; else entryTimeOK = false; So is there a way to check for replay true/fals or back testing true/false, even with a trick? Thx |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
|
To check whether it's running on realtime or historical data, you can work with Historical() - http://www.ninjatrader-support.com/H...istorical.html
To check if you're in the 'Strategy Analyzer' for example, you can add an input that you can set to 'true' if you're working there and then check for this in your code.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Feb 2009
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
Good thoughts. Thx for the hints.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Back Testing vs Live Sim | BigDog008 | Strategy Development | 1 | 03-20-2009 10:53 AM |
| Trying to understand a gap between replay testing and Live Sim ... | Learning1 | Strategy Analyzer | 6 | 12-03-2008 09:55 AM |
| Bad trade in live testing. | skellington | Strategy Development | 4 | 08-06-2008 08:03 AM |
| Different Results between Backtesting and Live Testing | vivienne | Automated Trading | 2 | 05-03-2007 03:45 AM |
| Different Results between Backtesting and Live Testing | vivienne | Miscellaneous Support | 0 | 12-31-1969 06:00 PM |