• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    https://ninjatrader.com/support/help.../calculate.htm

    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.

        https://drive.google.com/file/d/1MM5...w?usp=drivesdk
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by motog4, Today, 11:42 AM
        0 responses
        6 views
        0 likes
        Last Post motog4
        by motog4
         
        Started by derivtrader, Today, 11:20 AM
        2 responses
        9 views
        0 likes
        Last Post derivtrader  
        Started by TAJTrades, Today, 10:34 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by timcjpfx, Today, 10:20 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Eloi_, Today, 09:48 AM
        2 responses
        10 views
        0 likes
        Last Post Eloi_
        by Eloi_
         
        Working...
        X