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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        136 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
        120 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