Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Daily EMA last bar calc missing?

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

    Daily EMA last bar calc missing?

    I notice that in both a MarketAnalyzer and a Chart, the calcuated EMA for a range of daily data does not produce a result for the very last bar in the chart. For example, on 7/9 it only showed results up to 7/8, even after the market day ended and the 7/9 bar was closed.

    This is a problem since I need to know what the EMA was for the pervious day BEFORE the market opens the next day, not after it opens. I'm new to this, so I may easily be missing something.

    Also, is this a general issue with all indicators? Do indicators not get called for the very last bar until the next one opens?

    #2
    Please make sure you have both MarketAnalyzer and Chart set to the same CalculateOnBarClose setting.

    Comment


      #3
      Originally posted by NinjaTrader_Dierk View Post
      Please make sure you have both MarketAnalyzer and Chart set to the same CalculateOnBarClose setting.
      Yes, they are both set to CalculateOnBarClose = TRUE. (I don't want to waste time having the calculation done more than once per day.)

      Problem seems to be though, that a daily bar (of an index) is not recognized as "closed" until start of next day, so I can't see yesterday's EMA until after today's open. If trying to get any of the big daily EMAs (200, 50, etc.), they'll are delayed until start of next day, even though the previous day's bar is "closed" long before that.

      Surely there must be a workaround for this. I've also verified with another program that the EMAs being calculated by NT are correct, but am just missing that last day's calculated value, which, for most indices, should be available after the market closes that day.

      I just checked this again this morning, and the close from yesterday's index data is still not being used to calculate yesterday's EMA, even though the markets have been closed since yesterday afternoon. I presume that this won't be updated until the market opens today and the first data shows up for these stock indices.

      Comment


        #4
        >> Problem seems to be though, that a daily bar (of an index) is not recognized as "closed" until start of next day, so I can't see yesterday's EMA until after today's open. If trying to get any of the big daily EMAs (200, 50, etc.), they'll are delayed until start of next day, even though the previous day's bar is "closed" long before that.

        Not sure I follow. If that would be true than it would be true for chart and MA.

        Comment


          #5
          Originally posted by NinjaTrader_Dierk View Post
          Not sure I follow. If that would be true than it would be true for chart and MA.
          Yes, problem occurs whereever EMA is used, in both chart and MA.

          I've attached a small screen dump to illustrate the problem. The SP500 EMAs from daily data are not being calculated for the last closed bar, meaning I can't see what yesterday's value is for use today...

          Edit: I can see why this is not normally a problem for continuous data. But the daily index bar data has a big time gap between bars, so the "close" of a bar does not correspond to the "open" of the next bar. Perhaps the underlying NT code is not recognizing this issue, and is assuming that bar closes always occur with bar opens.
          Attached Files
          Last edited by greentrader; 07-10-2008, 05:11 AM.

          Comment


            #6
            Set CalculateOnBarClose=false to get the EMA for the last bar.

            Comment


              #7
              Originally posted by NinjaTrader_Dierk View Post
              Set CalculateOnBarClose=false to get the EMA for the last bar.
              Okay, but that just means that NT is spending all day needlessly recalculating EMAs just so I can see the one calculation it does at the end of the day that matters. As noted in my previous post, I think the underlying indicator update callback is flawed in that it does not recognize when bars like daily index bars are truly "closed". Unless I'm missing something, this appears to be a simple bug that should be fixed (TradeStation, for example, knows the difference, and updates such indicators on the same afternoon that the bar closes).

              Comment


                #8
                The previous bar is closed as the first tick of the next bar comes in. There is no "time based close" logic.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by robbsadler, Today, 07:53 AM
                0 responses
                1 view
                0 likes
                Last Post robbsadler  
                Started by aekzof, Today, 02:49 AM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by Primagenia, Today, 07:35 AM
                0 responses
                1 view
                0 likes
                Last Post Primagenia  
                Started by Románek, Today, 02:33 AM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Bobin, Today, 01:41 AM
                1 response
                17 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X