Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Buy/Sell this bar at close?

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

    Buy/Sell this bar at close?

    Hi,

    I am new to NT.
    In a strategy and backtesting can I buy or sell at the closing price of current bar, not the next bar at the opening price?

    The closing price of this bar and the opening price of the next bar is usually very much different for daily bars. The difference may be nill for short time frame bars, but it is big for daily bars.

    Any help will be greatly appreciated.

    #2
    Hello,

    Please review the Historical Fill part of this link and let me know if that answers your questions:


    Also, the Running a Strategy at the Close of a Bar or Tick by Tick section of this link:
    DenNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ben View Post
      Hello,

      Please review the Historical Fill part of this link and let me know if that answers your questions:


      Also, the Running a Strategy at the Close of a Bar or Tick by Tick section of this link:
      http://www.ninjatrader-support.com/H...sBacktest.html

      Thank you Ben.
      However, the links did not answer my question.

      I am building and testing a strategy on daily bars and figured out that order entry at close of this bar will perform better than entry next bar at open.
      Last edited by dowhk; 03-01-2010, 09:58 AM.

      Comment


        #4
        Hello,

        Sorry, do you still have a question or did you sort it out?
        DenNinjaTrader Customer Service

        Comment


          #5
          strategy test entry between high and low of the bar

          Hi

          I wanted to ask the same question. Links Originally Posted by NinjaTrader_Ben are not working anymore.

          1. is it possible to test a strategy historically using day charts and have an entry (or exit) at close and not entry at next open bar?
          2. Does a historic strategy test allow entry (and exit) which is between high and low of the bar? for example - if price drops 1% from the open bar -> entry position. if this is possible would the entry price be accurate? in that scenario entry price = bar open * (1 - 0.01)

          Comment


            #6
            Welcome to our forums Matiger, for this type of test you would need intraday data, daily would not be sufficient.

            Comment


              #7
              Bertrand thanks for your quick answer.
              Mathematically speaking daily data is sufficient (OHLC) but can not be calculated for the same bar as i understand. It would be very cool if that is possible.

              1. so to do what i want would mean to just export OHLC data to Excel and do calculation there.

              2. or maybe as a TD Ameritrade account holder can i get their intraday data (instead of kinetick) and do the history calculations as described in my question above? As far as I know historic strategy test is based on daily bars so i am afraid that is not possible? Or perhaps?

              Comment


                #8
                Correct, as NT's framework is event based, meaning if the bar has closed you're already at the open tick of the new bar, so that would be then first possible trade location.

                You could export data in NT's Historical Data Manager, yes and then self calculate in Excel if desired.

                Yes, with TDA you could access intraday minute data and work this into your strategy code with the concepts shown in our reference sample below -

                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

                Comment


                  #9
                  Originally posted by Matiger View Post
                  Hi

                  I wanted to ask the same question. Links Originally Posted by NinjaTrader_Ben are not working anymore.

                  1. is it possible to test a strategy historically using day charts and have an entry (or exit) at close and not entry at next open bar?
                  2. Does a historic strategy test allow entry (and exit) which is between high and low of the bar? for example - if price drops 1% from the open bar -> entry position. if this is possible would the entry price be accurate? in that scenario entry price = bar open * (1 - 0.01)
                  Have you tried:

                  Code:
                  double EntryPrice;
                  Code:
                  if (Historical) 
                  {
                  EntryPrice = Close[1];
                  }
                  else 
                  {
                  EntryPrice = Close[0]
                  }
                  // order goes here at EntryPrice.

                  Comment


                    #10
                    hi koganam

                    No i haven't tried it yet. I am still learning how to use NT.
                    But my guess is, if that so simple why is there no fast tutorial about it.
                    I wonder how come nobody else tried it before. For me is a basic to have entry and exit price exactly at the level when the signal triggers. Otherwise results are too random.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    601 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    347 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    103 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    559 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    558 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X