Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to user BarsSinceEntry?

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

    how to user BarsSinceEntry?

    Hey Guys, how are you? I hope so!!!

    I have developed a strategy that counts a certain number of bars before of the bar "0" to enter a position. Today, I put this rule in a plastered form, that is, I repeat it ten times in the Ninja Editor code... eg:

    && (Close[1] > Open[1])
    && (Close[2] < Open[2])
    && (Close[3] < Open[3])
    && (Close[4] < Open[4])
    && (Close[5] < Open[5])
    && (Close[6] < Open[6])
    && (Close[7] < Open[7])
    && (Close[8] < Open[8])
    && (Close[9] < Open[9])
    && (Close[10] < Open[10])

    I would like to optimize this setup and put a user input so that he can choose how many bars the setup will have to wait to close before giving an input, as well as being able to optimize this strategy in Analyzer.

    I know there is a barsSinceEntry feature.... But I don't know how to use it.

    Could someone kindly help me, please?

    Thank you from now on.

    #2
    Hello EvergreenGain,

    BarsSinceEntryExecution will return a number for the number of bars since the last execution. This will return -1 if there has never been an entry.

    An integer User Input will hold a whole number and can be used to compare with this.

    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X