Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars ago = "0"?

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

    Bars ago = "0"?

    Hi,

    Since bar "0" is referring to the current forming bar, And if we want to enter at the close of the candle.

    Would this mean we will need to make all our entry criteria based on bar "1", as once the close of the candle is achieved it would have moved from bar "0" to "1"?

    Thanks,

    Michael Hale

    #2
    Correct, run your strategy on CalculateOnBarClose = false and then place 'end of bar' calcs into

    Code:
     
    if (FirstTickOfBar)
    {
    do on close calcs and reference one bar back further
    }
    This would then enter on the second tick of the just opend bar...
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Using FirstTickOfBar() is quite restrictive. Ideally, you would want to write trade strategy programming code that works in both back testing and forward testing, as well as implementation.

      With CalculateOnBarClose() set to false, coding conditional statements that trigger an entry or exit using the [1] offset parameter should trigger a buy/sell the 'Open'. This approach also allows including additional conditional statments for intrabar considerations using the [0] offset parameter (such as immediate entry/exits).

      Comment


        #4
        borland, thanks for the input, unfortunately the tick formation is not known in backtesting (Calculate On Bar close always 'true'), thus you would need to add a more granular series to approximate intrabar fills then - http://www.ninjatrader-support2.com/...ead.php?t=6652
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by usazencort, Today, 01:16 AM
        0 responses
        1 view
        0 likes
        Last Post usazencort  
        Started by kaywai, 09-01-2023, 08:44 PM
        5 responses
        603 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        6 responses
        22 views
        0 likes
        Last Post xiinteractive  
        Started by Pattontje, Yesterday, 02:10 PM
        2 responses
        21 views
        0 likes
        Last Post Pattontje  
        Started by flybuzz, 04-21-2024, 04:07 PM
        17 responses
        230 views
        0 likes
        Last Post TradingLoss  
        Working...
        X