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 Barry Milan, Today, 10:35 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by WeyldFalcon, 12-10-2020, 06:48 PM
    14 responses
    1,428 views
    0 likes
    Last Post Handclap0241  
    Started by DJ888, Yesterday, 06:09 PM
    2 responses
    9 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    40 views
    0 likes
    Last Post jeronymite  
    Started by bill2023, Today, 08:51 AM
    2 responses
    16 views
    0 likes
    Last Post bill2023  
    Working...
    X