Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Overlaying bigger timeframe data on smaller timeframe

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

    Overlaying bigger timeframe data on smaller timeframe

    Hello, guys.
    I have a convern about the way the platform handles times. I will try to explain it as clear as I can.
    Lets focus on Daily Chart, overlaying Monthly data over it.
    What I expect: Bars after 01.01.2018 to have the current monthly value.

    What I do:
    I open up a Daily chart, add an indicator to it that adds a new data series to it using
    Code:
    AddDataSeries(BarsPeriodType.Month, 1);
    When I start outputing values, what I've noticed first is that the bars before the most current bar have different value than it even when they're part of the currently forming month (read: January 1-9).


    I've decided to print out the Times array and check what's happening, and what I've noticed is that the latest bar aligns with the current month, while all previous ones are 'lagging one month' on the second data series.
    The latest bar holds value for the current month, the other bars that are from the current month(January) hold values for the previous(December) and the bars from December hold values from (November).

    I tried to find a reasonable explanation for this behavior, but I can't think of one.

    In the screen shot you could see the values I get when outputting OnBarUpdate.
    Attached Files

    #2
    Hello AsterixBT,

    Welcome to the forums and thank you for your question!

    This has to do with the an indicator being calculated with Calculate.OnBarClose. Each closing bar of the the Daily data series will tell you the close of that bar. Since the monthly bar has not been closed, CurrentBar for the monthly data series will keep the last close value, or that last month.

    Calculate.OnEachTick could update the current bar value with each incoming tick, and those ticks would have the close time for the bar that the ticks are developing.

    For further tests, you can use the attached indicator with Calculate.OnBarClose and Calculate.OnEachTick on EURUSD with Calculate set to OnBarClose and OnEachTick.

    I've included publicly available documentation for reference as well.

    Calculate - https://ninjatrader.com/support/help.../calculate.htm

    If there is anything else you would like me to provide input on, please let me know.
    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #3
      Greeting, Jim!

      The thing is that the output I've attached is from an indicator that's being set to Calculate OnEachTick.
      You notice see the behavior at the last output where a bar from the daily's ticking twice (once triggered from monthly timeframe bar update).
      Still, the data for the previous bars' remain incorrect relative for the current month. Is there a way I could overcome this calculating issue or I should manually iterate over the bars from the current month and re-set the values of the indicators on State.Realtime?

      Thank you for your time.

      Comment


        #4
        Hello AsterixBT,

        Looking at your output window, I am seeing CurrentBar iterations as a new value for your daily series which would tell me that it is using Calculate.OnBarClose.

        I added prints for CurrentBar values and created a video showing how these values iterate with Calculate.OnBarClose and Calculate.OnEachTick as well as how the "first tick of a new bar" closes the previous bar and is then used to develop the next bar. This can be seen when a new daily bar iterates and closes the last monthly bar.

        Demo: https://www.screencast.com/t/5nCBExT5

        After running through the same tests, please let me know if you see anything inconsistent.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by alifarahani, Today, 09:40 AM
        2 responses
        12 views
        0 likes
        Last Post alifarahani  
        Started by junkone, Today, 11:37 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by pickmyonlineclass, Today, 12:23 PM
        0 responses
        1 view
        0 likes
        Last Post pickmyonlineclass  
        Started by frankthearm, Yesterday, 09:08 AM
        12 responses
        44 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        35 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X