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 Shai Samuel, Today, 12:22 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_SeanH  
        Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
        12 responses
        728 views
        0 likes
        Last Post Adnoker
        by Adnoker
         
        Started by torento, Yesterday, 05:43 PM
        3 responses
        65 views
        0 likes
        Last Post NinjaTrader_Kennedy  
        Started by M_ichel, 01-29-2023, 11:17 AM
        7 responses
        114 views
        0 likes
        Last Post M_ichel
        by M_ichel
         
        Started by tkaboris, Today, 10:46 AM
        6 responses
        26 views
        0 likes
        Last Post tkaboris  
        Working...
        X