Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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 f.saeidi, Today, 08:01 PM
|
0 responses
1 view
0 likes
|
Last Post
by f.saeidi
Today, 08:01 PM
|
||
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, Today, 07:51 PM
|
0 responses
3 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by frslvr, 04-11-2024, 07:26 AM
|
5 responses
96 views
1 like
|
Last Post
by caryc123
Today, 07:47 PM
|
||
Started by algospoke, 04-17-2024, 06:40 PM
|
6 responses
49 views
0 likes
|
Last Post
by algospoke
Today, 06:18 PM
|
||
Started by arvidvanstaey, Today, 02:19 PM
|
4 responses
11 views
0 likes
|
Last Post Today, 04:08 PM |
Comment