![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
To check for the most recent occurence of a particular condition you can write something like:
Quote:
Ray
Ray
NinjaTrader Customer Service |
|
|
|
|
|
|
#2 |
|
Member
Join Date: Feb 2007
Location: , ,
Posts: 71
Thanks: 0
Thanked 0 times in 0 posts
|
Wouldn't this code snippet find the FIRST occurrence of the test case ... not the most recent. I believe you'd want to go backwards or count down from Current bar to 0 to find the most recent occurrence.
Please advise if I am mistaken. |
|
|
|
|
|
#3 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
You are mistaken.
Do not confuse "CurrentBar" with an index value that represents the number of bars ago. Ray
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#4 |
|
Member
Join Date: Feb 2007
Location: , ,
Posts: 71
Thanks: 0
Thanked 0 times in 0 posts
|
Sorry ... you are correct. I misread how the index was being used. I thought the code was just cycling through the bars on the chart starting at index 0.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|