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 Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,789 views
        0 likes
        Last Post aligator  
        Started by Jimmyk, 01-26-2018, 05:19 AM
        6 responses
        837 views
        0 likes
        Last Post emuns
        by emuns
         
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,293 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        13 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        63 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X