Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars Since Entry/Exit

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

    #16
    If using bars since EXIT, if there have been no exits yet, what do you do to initiate the first trade?

    Comment


      #17
      Hello cupir2,

      BarsSinceExitExecution() will return a negative 1 if there have not been any exits.

      Below is a public link to the help guide on BarsSinceExitExecution().


      In the condition builder compare BarsSinceExitExecution() to a Misc > Numeric value and set the value to -1 to detect if no exit has been placed.

      Check for both BarsSinceExitExecution() and BarsSinceEntryExecution() to both have a value of -1 if you are wanting to detect when there have been no trades.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Using with strategy and OnBarClose and exit set to trigger as below

        (BarsSinceEntryExecution(0, "", 0) > 1)

        I want to be clear on when it will execute, I know that bar 0 where the 1 is shown would be the entry bar, when we close that bar then we are on bar 1, so greater than 1 will be when the next bar opens

        Question - will the exit order be sent instantly when that bar opens and if back testing the exit will calculate on the Open of that bar as well?

        Thanks

        Comment


          #19
          Hello DTSSTS,

          In backtesting everything is run OnBarClose, the order would be evaluated when the bar close is processed and OnBarUpdate is called. The historical fills would pass through the historical fill engine, you can read about that here: https://ninjatrader.com/support/help...lFillAlgorithm

          In a realtime situation and if the strategy is using OnEachTick calculation the order could be sent immediately. If you are using OnBarClose processing then the order will be submitted once the bar closes.

          Comment


            #20
            (BarsSinceEntryExecution(0, "", 0) > 1)

            "once the bar close" is once bar 1 reference above closes, so in this code as soon as the 3 bar of the trade opens the the order is sent

            thanks

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            62 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            134 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            75 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            45 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            50 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X