Announcement

Collapse
No announcement yet.

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)

    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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        47 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        23 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        33 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        51 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Working...
        X