Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter On Next Open, Exit at Session End

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

    Enter On Next Open, Exit at Session End

    I am having some difficulty setting up a strategy that will:
    a. Enter on Open of Bar.
    b. Exit at Close of Bar.

    A code snippet of how to accomplish this within a strategy would be greatly appreciated.
    Thanks!

    #2
    Hello,

    This is only possible in realtime with NinjaTrader. As indicators and strategy only calculate on the close of the bar so it is not possible to open a new position until the the bar closes on each bar. This is for historical processing and backtesting.

    You can however run an indicator or strategy with calculate on bar close = false in the parameters and this will run on every tick incomming into NinjaTrader. In which case you would use FirstTickOfBar to do this live.

    BrettNinjaTrader Product Management

    Comment


      #3
      Here is the problem in more detail:
      1. At market close, calculate a signal.
      2. On market open the next day, enter at market order.
      3. That same day, if stop has not been triggered, close the position at 4:00. Repeat.

      O--------C--------O--------C
      ----------(1)-------(2)------(3)

      The backtesting system is not showing the entry until the Close of the NEXT bar, which is way too late.
      O--------C--------O--------C--------O--------C
      ----------(1)-----------------(2)-----------------(3)
      This is completely not what I need. I need for the trade to be in force for a maximum of one day, and to enter on the opening value of the upcoming trade session. How can I make this happen?
      Thanks!
      Last edited by neuro_doc; 05-15-2011, 07:23 PM.

      Comment


        #4
        I have found something which will very closely approximate what I am looking for of being able to enter on the next open in backtesting...

        You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


        The example download file does cover this, so it is definitely possible within NT.

        Thanks!

        Comment


          #5
          Hello,

          Glad you where able to find this that works for you!

          Let me know if I can be of further assistance.
          BrettNinjaTrader Product Management

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          668 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          377 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          110 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          575 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          580 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X