Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy calclulated vs. chart displayed values are different

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

    Strategy calclulated vs. chart displayed values are different

    Hi,
    I am noticing SMA/EMA 50 on daily and 60 Minutes charts have different values than the ones that are calculated in my strategy.

    Code:
    Code:
    Ofile.WriteLine("\r\nDaily EMA50="+EMA(BarsArray[1],50)[0]);
    Ofile.WriteLine("\r\nDaily SMA50="+SMA(BarsArray[1],50)[0]);                    
    Ofile.WriteLine("\r\n60 Min EMA50="+EMA(BarsArray[2],50)[0]);
    Ofile.WriteLine("\r\n60 Min SMA50="+SMA(BarsArray[2],50)[0]);
    Results:

    Fetch Time=Thu-Jan-10-2013-11-47-28AM

    YM 03-13

    Current Price=13340

    Daily EMA50=13034.44

    Daily SMA50=13076.45

    60 Min EMA50=13325.25

    60 Min SMA50=13310.6

    Average_Range=83

    OPEN P0 =13328 HIGH P0 =13389 LOW P0 =13316 CLOSE P0 =13340 RANGE P0 =2
    OPEN P1 =13266 HIGH P1 =13356 LOW P1 =13264 CLOSE P1 =13330 RANGE P1 =92
    OPEN P2 =13290 HIGH P2 =13309 LOW P2 =13232 CLOSE P2 =13268 RANGE P2 =77
    OPEN P3 =13361 HIGH P3 =13366 LOW P3 =13272 CLOSE P3 =13315 RANGE P3 =94
    OPEN P4 =13322 HIGH P4 =13377 LOW P4 =13296 CLOSE P4 =13358 RANGE P4 =81
    OPEN P5 =13324 HIGH P5 =13360 LOW P5 =13287 CLOSE P5 =13321 RANGE P5 =73

    Note: I have used both Zenfire and IB's data feed and the calculated results are off than then the values displayed in chart.

    Can anyone help shed some light on this?

    regards,
    tariq
    Last edited by mypkonline; 01-10-2013, 11:17 AM. Reason: correcting Title

    #2
    What are the values on the chart? How much is it off? Did you include that? Sorry if I'm missing something.

    What is the purpose of Average_range and Open P0, etc?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Sorry, please ignore the other values (copy/paste).

      Let's look at the daily EMA data at 1PM today for YM 03-13, it is off by 60 Ticks. Also, 60 minutes data was off by ~ 4 ticks.

      Fetch Time=Thu-Jan-10-2013-01-00-47PM
      YM 03-13

      Current Price=13369

      Daily EMA50=13035.57

      Daily Chart Value = 13094

      60 Min EMA50=13328.98
      60 Min Chart Value 13331
      Attached Files

      Comment


        #4
        I don't see the same behavior here.

        Could it be the indicator on the chart is set to CalculateOnBarClose = true, while the strategy is on COBC = false?

        I'd also suggest adding the strategy to the same exact chart you're looking at the indicators to ensure they're looking at the same exact data points. For example, since you're looking at a 50 Period Daily SMA, you'd need to sure there are enough daily bars to come up with the correct figures.
        MatthewNinjaTrader Product Management

        Comment


          #5
          Thanks Matthew,

          No, I have both places CBOC set to false. The chart and the strategy.

          Could this has to do with how the daily candles are formed. Different Close times?

          I am testing with Zenfire and IB data feeds .

          My template from instrument manager set to for YM CME US Futures Index ETH.
          My Chart UI is set to "Use Instrument setting ".
          My Chart Indicators are set to COBC false.
          My Minimum bars required are set to 10 and days to load is 50
          Strategy has enough bars as I check for
          Code:
          if (CurrentBars[1] < BarsRequired) {Print(Instrument.FullName+" Getting Bars[1] Required"); return;}
          Last edited by mypkonline; 01-11-2013, 01:04 PM. Reason: adding

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by alifarahani, Today, 09:40 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by RookieTrader, Today, 09:37 AM
          4 responses
          18 views
          0 likes
          Last Post RookieTrader  
          Started by PaulMohn, Today, 12:36 PM
          0 responses
          5 views
          0 likes
          Last Post PaulMohn  
          Started by love2code2trade, 04-17-2024, 01:45 PM
          4 responses
          40 views
          0 likes
          Last Post love2code2trade  
          Started by junkone, Today, 11:37 AM
          3 responses
          26 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X