Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Buy at the Close Sell at the Open

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

    Buy at the Close Sell at the Open

    I'm a NT newbie but a seasoned programmer. I think I see how to make a decision to enter long at the end of the day but how would I sell at the open of the next day?

    #2
    Hello TommyTFC,

    Welseome to the NinjaTrader Support Forums!

    The easiest method to accomplish this would be to use Time filters that would be based on your Local PC clock. You may see the following thread for more information and a reference sample on this.
    http://www.ninjatrader.com/support/f...ead.php?t=3226

    Also, you may use the FirstBarOfSession to for the open, but there is no supported LastBarOfSession.

    http://www.ninjatrader.com/support/h...rofsession.htm

    Let us know if we can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      That helps. I was using a Day type of data series for back testing. I'm guessing that I need to use minute or tick or something. Otherwise if it's day I would never get the opening since I either have to CalculateOnBarClose or not.

      Comment


        #4
        Hello TommyTFC,

        If you are using a Day Period Type with backtesting and you would like intraday fills, you may want to program intrabar granularity in your strategy. When backtesting CalculateOnBarClose(COBC) is always going to be set to true. You may see the following thread that goes over how to add intrabar granularity.
        http://www.ninjatrader.com/support/f...ead.php?t=6652
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X