![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Mar 2012
Posts: 102
Thanks: 29
Thanked 4 times in 4 posts
|
I am trying to debug a script. I want to check a specific bar on the strategy tester.
I will need the info for a specific date/time... see the red highlight below. I cannot find this in the ref section. protectedoverridevoid OnBarUpdate() { SMACurrent=SMA(BarsArray[0],50)[0]; SMAPast=SMA(BarsArray[0],50)[1]; //if SMACurrent>SMAPast consider this an up trend if (SMACurrent > SMAPast) <<<< and DateTime of a bar = '8/15/2012 5:00:00 AM { objBarsAgoNumber.Set (Closes[0][1]); BarsAgoNumber = (HighestBar (objBarsAgoNumber,30)+1); HighValuePast=MAX(High,30)[1]; HighValueCurrent=Closes[0][0]; Thank you, Duke |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Sep 2008
Posts: 543
Thanks: 80
Thanked 187 times in 131 posts
|
Is this what you're looking for?
DateTime thatOneTime = new DateTime(2012, 8, 15, 5, 0, 0); if (SMACurrent > SMAPast && Time[0] == thatOneTime) {...} |
|
|
|
|
The following user says thank you to Radical for this post: |
|
|
|
#3 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,770
Thanks: 158
Thanked 562 times in 553 posts
|
Duke,
You can obtain this information just by calling Time[0]. You'd wanna put this below your condition. Code:
if (SMACurrent > SMAPast) <<<< and DateTime of a bar = '8/15/2012 5:00:00 AM
{
Print(Time[0]);
}
Matthew
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Matthew for this post: |
|
|
|
#4 |
|
Senior Member
Join Date: Mar 2012
Posts: 102
Thanks: 29
Thanked 4 times in 4 posts
|
Thank you... It is exactly what I was looking for.
Duke |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Mar 2012
Posts: 102
Thanks: 29
Thanked 4 times in 4 posts
|
I need to process a certain bar at a given time. It needs to be a condition of getting thru the 'if' statement.
Thanks, Matthew... |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Logical Comparisons of BarArray and Time values Question | Kel108 | General Programming | 5 | 08-09-2012 11:19 AM |
| Time Comparisons - Trade Exit | Scarlett09 | Strategy Development | 1 | 07-31-2012 08:31 AM |
| Maximum Bars Look Back + Comparisons | MicroTrends | Version 7 Beta General Questions & Bug Reports | 6 | 05-20-2010 05:55 PM |
| Data Service Provider Comparisons | miker | Connecting | 1 | 03-25-2009 08:19 AM |
| Multiple time frame indicator comparisons | radford0222 | Strategy Analyzer | 1 | 02-04-2009 03:39 PM |