Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy OnBarClose with indicator OnEachTick

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

    Strategy OnBarClose with indicator OnEachTick

    Hello,

    Next you can find some prints from an strategy with Calculate set OnBarClose. Strategy includes three instances of an indicator with Calculate set OnEachTick within indicator code, and to maintain this property, within strategy OnStateChange - Historical , Calculate is set to OnEachTick.
    When load, historical data looks as expected, but when real time arrives, the secuence is not equal.

    Is this setup correct? The goal is run an strategy with Calculate -> OnBarClose with indicators with Calculate -> OnEachTick

    Historical
    Code:
    Strategy - State: Historical Calculate: OnBarClose CurrentBAR: 4015
    Indicator X with period - 2 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4016
    Indicator X with period - 6 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4016
    Indicator X with period - 10 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4016
    Strategy - State: Historical Calculate: OnBarClose CurrentBAR: 4016
    Indicator X with period - 2 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4017
    Indicator X with period - 6 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4017
    Indicator X with period - 10 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4017
    Strategy - State: Historical Calculate: OnBarClose CurrentBAR: 4017
    Indicator X with period - 2 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4018
    Indicator X with period - 6 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4018
    Indicator X with period - 10 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4018
    Strategy - State: Historical Calculate: OnBarClose CurrentBAR: 4018
    Indicator X with period - 2 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4019
    Indicator X with period - 6 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4019
    Indicator X with period - 10 bars  - State: Historical Calculate: OnEachTick CurrentBAR: 4019
    Enabling NinjaScript strategy ...
    Code:
    Strategy - State: Realtime Calculate: OnBarClose CurrentBAR: 4019
    Strategy - State: Realtime Calculate: OnBarClose CurrentBAR: 4020
    Strategy - State: Realtime Calculate: OnBarClose CurrentBAR: 4021
    Indicator X with period - 2 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4020
    Strategy - State: Realtime Calculate: OnBarClose CurrentBAR: 4022
    Indicator X with period - 2 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4021
    Indicator X with period - 6 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4020
    Indicator X with period - 10 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4020
    Strategy - State: Realtime Calculate: OnBarClose CurrentBAR: 4023
    Indicator X with period - 2 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4022
    Strategy - State: Realtime Calculate: OnBarClose CurrentBAR: 4024
    Indicator X with period - 2 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4023
    Strategy - State: Realtime Calculate: OnBarClose CurrentBAR: 4025
    Indicator X with period - 2 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4024
    Indicator X with period - 6 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4021
    Indicator X with period - 6 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4022
    Indicator X with period - 6 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4023
    Indicator X with period - 10 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4021
    Indicator X with period - 10 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4022
    Indicator X with period - 10 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4023
    Indicator X with period - 6 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4024
    Indicator X with period - 10 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4024
    Strategy - State: Realtime Calculate: OnBarClose CurrentBAR: 4026
    Indicator X with period - 2 bars  - State: Realtime Calculate: OnEachTick CurrentBAR: 4025

    #2
    Hello Optiondreamer,

    In historical Calculate is always 'On bar close' unless you have TickReplay enabled.

    Below is a public link to the help guide.


    Do you have TickReplay enabled with a connection to a provider that provides historical tick data?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Tick Replay is enabled and provider is IQFeed.

      Comment


        #4
        Hello Optiondreamer,

        With TickReplay enabled, I would expect real-time and historical prints for a single strategy to match.

        Your prints don't show the same bar times so we can't compare.

        But below is a link to a short video that shows printing prints for minute in real-time and comparing this with TickReplay in historical data for the same minute. The results are exactly the same.

        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        64 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        139 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X