Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Buy on Close (Today)

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

    #16
    This would be expected in backtesting capstonetrader, after your exit triggers then next possible trade location is the open of the next bar, this is NT's conservative approach here.

    Comment


      #17
      Originally posted by capstonetrader View Post
      Thanks, the best I could do in the Ninja Script was:
      If (ToTime(Time[0]) == 1200 && Close[0]>=0)
      {
      ExitShort("exit signal name", "entry signal name");
      }

      It would not let me compile if I just state:

      Then ExitShort This Bar on Close;

      after the Time and Close >= 0 condition.

      So with the Ninja script above, it still exits at the open of the next bar instead of the close of the current bar.
      Intraday, for most cases, there is no difference between the close of one bar and the open of the next. However, if this must be coded as you seem to want, then your only real choice is to calculate the time the bar will close, and exit at that time. On a fixed time frame chart, you know the time the last bar closed (Close[1]), so you merely need to add the time for your chart period to that time, and set the exit based on that time.

      Comment


        #18
        Q

        Originally posted by NinjaTrader_Bertrand View Post
        This would be expected in backtesting capstonetrader, after your exit triggers then next possible trade location is the open of the next bar, this is NT's conservative approach here.
        Bertrand when you say "this is nt's conservative approach" are you suggesting this because although it occurs, the close of one bar and the open of another are not always equal and in real time / real life....If a close is gone, its in the past and the price cannot be accessed by a limit order or such if the price has moved against you by the open of the next bar?

        Meaning its more realistic....

        Comment


          #19
          Correct conservative in the sense of more realism, as when you're detecting a bar close in an event based framework you're essentially seeing it earliest at the open of the next bar, thus offering a fill on the close of the bar before is not adequate we felt.

          Comment


            #20
            You can always use ExitLongLimit() with a limit price at the Close[0]. Of course, that would then be subject to the problem with all limit orders, and how they get filled.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            153 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            89 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            133 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            128 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            107 views
            0 likes
            Last Post CarlTrading  
            Working...
            X