Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop strategy for 5 minutes after entry

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

    Stop strategy for 5 minutes after entry

    Hello, how can I make a stop strategy for 5 minutes after last entry ? Thank you

    #2
    Hello Uregon,

    To confirm, you want to place an entry and then after 5 minutes submit a exit market order?

    If this is a minute chart, you could use BarsSinceEntryExecution() to be greater than 5 in the condition and submit an exit market order.


    If this is not a minute chart, you could add a 1 minute series with AddDataSeries(), and submit the orders to the BarsInProgress index of that series to trigger the order after 5 bars.


    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_ChelseaB

      Hello Chelsea,

      no I´m looking for that no trades will be placed anymore for 5 minutes after the last trade.

      As example:

      15:50 LONG
      15:51 ACCEPT NO NEW TRADE SIGNALS
      15:52 ACCEPT NO NEW TRADE SIGNALS
      ​​​​​​​15:53 ACCEPT NO NEW TRADE SIGNALS
      ​​​​​​​15:54 ACCEPT NO NEW TRADE SIGNALS
      ​​​​​​​15:55 WAIT FOR NEW TRADE SIGNALS

      Comment


        #4
        Hello Uregon,

        You can use BarsSinceExitExecution() greater than 5 to prevent calling the entry order after the last trade exit on a 1 minute series.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          NinjaTrader_ChelseaB

          Hello Chelsea,

          in this code a trade must be closed that this is triggered.

          But I´d like to look for a code where also an open order will be considered.

          15:50 Strategie placed order 1 LONG

          5 minutes locked
          15:51 ACCEPT NO NEW TRADE SIGNALS (LONG 1 is still open)
          15:52 ACCEPT NO NEW TRADE SIGNALS (LONG 1 is still open)
          15:53 ACCEPT NO NEW TRADE SIGNALS (LONG 1 is still open)
          15:54 ACCEPT NO NEW TRADE SIGNALS (LONG 1 is still open)


          ​​​​​​​​​​​​​​5 Minutes are over
          15:55 WAIT FOR NEW TRADE SIGNALS (LONG 1 is still open)
          ​​​​​​​15:56 WAIT FOR NEW TRADE SIGNALS (LONG 1 is still open)
          ​​​​​​​15:57 WAIT FOR NEW TRADE SIGNALS (LONG 1 is still open)


          ​​​​​​​15:58 Strategie placed order 2 LONG (LONG 1 + Long 2 is open)


          5 minutes locked
          15:59 ACCEPT NO NEW TRADE SIGNALS (LONG 1 + Long 2 is open)
          16:00 ACCEPT NO NEW TRADE SIGNALS (LONG 1 + Long 2 is open)
          ​​​​​​​16:01 ACCEPT NO NEW TRADE SIGNALS (LONG 1 + Long 2 is open)
          ​​​​​​​16:02 ACCEPT NO NEW TRADE SIGNALS (LONG 1 + Long 2 is open)


          5 Minutes are over
          16:03 ​​​​​​​WAIT FOR NEW TRADE SIGNALS (LONG 1 + Long 2 is open)

          and so on...

          Comment


            #6
            Hello Uregon,

            A Trade has two orders, an entry and an exit. It's not a full trade if there is an entry and no exit, instead that is an open position.

            "no I´m looking for that no trades will be placed anymore for 5 minutes after the last trade."
            Is this actually what you want?

            You can check both the bars since entry and bars since exit are both 5..
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Uregon If you literally just want to place an Order and then immediately wait 5 minutes before accepting any other Orders, why not just check clock times?

              For example (untested code, but should be easy to test/modify):
              Code:
              ...
              TimeSpan WaitPeriod = new TimeSpan(0,5,0);   // Set this to any value you want, defaulting to 5 mins here
              DateTime MostRecentOrderSubmitTime = DateTime.Now - WaitPeriod;    // Subtract the WaitPeriod to start with so the first Order is not blocked
              ...
              // Check if the WaitPeriod has passed, then OK to submit or any other action you want after that time ...
              if (DateTime.Now >= MostRecentOrderSubmitTime + WaitPeriod)    // At least 5 mins has passed, so OK to Submit or other actions
              {
                  // Submit in whatever way you want, then ...
                  MostRecentOrderSubmitTime = DateTime.Now;
              }
              ...
              This way ensures you have a clock-based wait period that is independent of any other trade criteria, DataSeries, etc.

              Hope that's useful.

              Thanks.
              Multi-Dimensional Managed Trading
              jeronymite
              NinjaTrader Ecosystem Vendor - Mizpah Software

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              59 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
              74 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