Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EnerLong on bar close (Daily bar)

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

    EnerLong on bar close (Daily bar)

    Hi,

    I am backtesting a system that will open a position by the end of the day if to go long before the close of market. Therefor, I want to enter the position on a price that will be equal to the Close of the current bar. When I EnterLong the position is being opened only on the next bar (tomorrow). IsFirstTickOfBar does not work as well, as the historic data is day.

    Any idea how to enter the position on current bar close?

    Thanks


    #2
    Hello newdill,

    Welcome to the NinjaTrader forums!

    When NinjaTrader is running with Calculate set to OnBarClose, orders are placed after the bar closes using logic calculated from that bar.

    Below is a link to the help guide on the Calculate property.
    http://ninjatrader.com/support/helpG.../calculate.htm

    This means that any orders that are triggered from that bar are submitted after the bar closes as the new bar opens. As the order is placed as the new bar opens and the timestamp of the order is within the time of the next bar, the order will show on the next bar.

    If the strategy were running with Calculate as OnPriceChange or OnEachTick, or if the script has intra-bar granularity with AddDataSeries() and submitted orders on a smaller timeframe, this would cause the timestamp of the order to be within the bar it is triggered on as the order may be submitted intra-bar. This order would show on the same bar as the bar that triggered the order submission.
    https://ninjatrader.com/support/help...dataseries.htm
    https://ninjatrader.com/support/help...ipt_strate.htm

    In historical data, Calculate will always be OnBarClose unless TickReplay is enabled for the data series.
    https://ninjatrader.com/support/help...ick_replay.htm

    This is outlined in the help guide Discrepancies: Real-Time vs Backtest.
    http://ninjatrader.com/support/helpG...ime_vs_bac.htm

    Also, below is a link to a forum thread about intra-bar granularity.
    http://ninjatrader.com/support/forum...297#post491297
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by TheCatTrader, Today, 04:52 PM
    0 responses
    4 views
    0 likes
    Last Post TheCatTrader  
    Started by localappleseed, Today, 04:10 PM
    0 responses
    8 views
    0 likes
    Last Post localappleseed  
    Started by Ragstoriches, Today, 03:13 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by michaelsh, Today, 03:21 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by Ragstoriches, Today, 02:53 PM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Emily  
    Working...
    X