Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 ghoul, Today, 06:02 PM
        0 responses
        7 views
        0 likes
        Last Post ghoul
        by ghoul
         
        Started by Barry Milan, Yesterday, 10:35 PM
        6 responses
        18 views
        0 likes
        Last Post Barry Milan  
        Started by DanielSanMartin, Yesterday, 02:37 PM
        2 responses
        13 views
        0 likes
        Last Post DanielSanMartin  
        Started by DJ888, 04-16-2024, 06:09 PM
        4 responses
        13 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        12 views
        0 likes
        Last Post terofs
        by terofs
         
        Working...
        X