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

Wait with new order - Bars Since Entry

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

    Wait with new order - Bars Since Entry

    Hello i tried that the strategy have to wait 5 bars after the Entry execution to take a new trade with this code:

    if((BarsSinceEntryExecution(0, "TradeEntry", 1) > 5 || BarsSinceEntryExecution(0, "TradeEntry", 1) == -1) || (BarsSinceExitExecution(0, "TradeEntry", 1) > 2 || BarsSinceExitExecution(0, "TradeEntry", 1) == -1))

    But it isnt working. Does anyone have some ideas?

    Thanks
    R

    #2
    Hello Lopat,

    That is possibly due to also including exit executions, you would need to use a print to output the values for both BarsSinceEntryExecution and BarsSinceExitExecution to know why that condition is false. BarsSinceEntryExecution is used only as a 2 part condition normally, for example this is how you would check for 5 bars:


    Code:
     if (BarsSinceEntryExecution() > 5|| BarsSinceEntryExecution() == -1)
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you for your fast response. I want to try this in a mtf strategy. So i have to you this one:

      BarsSinceExitExecution(int barsInProgressIndex, string signalName, int exitExecutionsAgo)

      But i cannot do that it is working... Do you have an example?

      Comment


        #4
        Hello Lopat,

        What did you try and was there an error or what was not working?

        The overload you are using is asking for the BarsInProgress which is the series that you submitted the orders to along with the signal name and the number of executions ago that you wanted to check. The values could change depending on your use case.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Option Whisperer, Today, 09:55 AM
        1 response
        11 views
        0 likes
        Last Post bltdavid  
        Started by port119, Today, 02:43 PM
        0 responses
        1 view
        0 likes
        Last Post port119
        by port119
         
        Started by Philippe56140, Today, 02:35 PM
        0 responses
        2 views
        0 likes
        Last Post Philippe56140  
        Started by 00nevest, Today, 02:27 PM
        0 responses
        1 view
        0 likes
        Last Post 00nevest  
        Started by Jonafare, 12-06-2012, 03:48 PM
        5 responses
        3,986 views
        0 likes
        Last Post rene69851  
        Working...
        X