Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtesting trade on day's close

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

    Backtesting trade on day's close

    Let's say my indicator was triggered at the close of the daily bar on day X. When I do any enter position (limit or not) command in the backtest, it initiates the trade at X+1. I've managed for now to change it so that when I enter the position, I trigger at day X's closing price. However, it's still being entered on day X+1.

    Is there a way such that I can backtest getting the close of day X, and (retroactively?) entering an order on day X at the close price?

    Does this have anything to do with how the daily closes are read? eg. Are they read in as of 12am the next day or something? I use esignal for my feed.

    #2
    Hi pretender,

    Historical order timings always works the same and you could not change to submit to close of a bar. A condition evaluates true and then order is submitted to the next bar. In real time and with CalculateOnBarClose = false, conditions are evaluated with each tick and if true will submit the orders while the bar is forming.

    To get increased granularity in historical you can add a smaller, secondary time frame, following principles in this reference sample:
    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


    With this, the order is still submitted to the next bar after the condition, but the smaller series provides increased granularity.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    61 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    39 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    21 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    23 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    51 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X