• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Consectutive Bar Counter

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Consectutive Bar Counter

    Would anyone be able to help me with a trigger that would enter based upon a number of consecutive green or red bars?

    #2
    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.
    https://ninjatrader.com/support/foru...040#post786040

    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.
    https://www.dotnetperls.com/for
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by digibob, Today, 01:13 AM
    0 responses
    2 views
    0 likes
    Last Post digibob
    by digibob
     
    Started by kemoleena, Today, 12:31 AM
    0 responses
    5 views
    0 likes
    Last Post kemoleena  
    Started by aligator, 09-18-2019, 12:15 PM
    12 responses
    104 views
    0 likes
    Last Post Lancer
    by Lancer
     
    Started by StevenNelson, Yesterday, 05:45 PM
    0 responses
    7 views
    0 likes
    Last Post StevenNelson  
    Started by calebsandfort, Yesterday, 05:16 PM
    1 response
    7 views
    0 likes
    Last Post calebsandfort  
    Working...
    X