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!
See more
See less

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 mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    4 views
    0 likes
    Last Post tkaboris  
    Started by GussJ, 03-04-2020, 03:11 PM
    16 responses
    3,282 views
    0 likes
    Last Post Leafcutter  
    Started by WHICKED, Today, 12:45 PM
    2 responses
    20 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Working...
    X