Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Consectutive Bar Counter
Collapse
X
-
Hello Rogue_Two,
If you are creating this in the Strategy Builder you would need to create multiple conditions in the condition set using bars ago indexes.
Compare the Price -> Close with 0 bars ago to be greater than the Price -> Open with 0 bars ago for the first condition.
Compare the Price -> Close with 1 bars ago to be greater than the Price -> Open with 1 bars ago for the first condition.
etc. continuing for the number of bars you would like to check on each update.
Below is a public link to a forum post with helpful information about getting started with NinjaScript. Please take a look at the Strategy Builder 301 training video linked in this post.
If you wanted to be able to choose the number of bars from an input this would require unlocking the script and using a loop.
Below is a public link to a 3rd party education site that demonstrates how to use a for loop.
Chelsea B.NinjaTrader Customer Service
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
59 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
34 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
198 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
363 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
282 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|

Comment