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...

    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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        144 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        70 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        78 views
        0 likes
        Last Post PaulMohn  
        Working...
        X