Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculateOnBarClose = false\true

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

    CalculateOnBarClose = false\true

    Hi,
    Can anybody say is it possible to enter position when CalculateOnBarClose = true and exit position wen it is false??

    #2
    nkonkov, it is definitely possible to use the two settings albeit with a slight workaround as described in the reference sample titled Separating logic to either calculate once on bar close or on every tick.

    Basically, you will use CalculateOnBarClose = false and use a filter in OnBarUpdate() like this:
    Code:
    OnBarUpdate()
    {
       if (FirstTickOfBar)
       {
          // do once per bar calculations at the very beginning of the bar. be sure to adjust your bar indexes by -1 because the bar of interest is now one bar back.
       }
    }
    AustinNinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_Austin, thanks a lot!!! it really works in live trading. But there is still a problem: how to backtest this strategy. I have tick data imported in NT.

      Comment


        #4
        nkonkov, this can unfortunately not easily be done, as in backtesting you would only have access to the bar's OHLCV info. Best next step would be to work results for past out in our Market Replay, which allows you replaying the days at 500X speed with access to the intrabar formation needed for testing this setup.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        649 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X