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

Multi Timeframe Plot is Different Than Chart Plot for 60 Minute Chart

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

    Multi Timeframe Plot is Different Than Chart Plot for 60 Minute Chart

    Hi,

    I created a simple multi-timeframe 200-SMA plot for a 60-minute dataseries. But, when I add the plot to a 1-minute chart, I noticed that the 200-SMA 60-minute plot does not agree with the actual version of the 200-SMA on the 60-minute chart. This problem appears to only happen for a 60-minute data series. I tested for a 5-minute dataseries and it seems to be working fine. Can anyone tell me what I am doing wrong?

    Edit: I tested this problem using the stock "MAR" on 10/15/2010

    Thanks in advance



    Code:
    protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
                Add(PeriodType.Minute, 60);
                
                Overlay                = false;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
               
                
                if (CurrentBar < 201 )
                 return;
                
                
                if (BarsInProgress != 0 )
                 return;
                Plot0.Set(SMA(BarsArray[1], 200)[0]);
            }

    #2
    Are you loading enough days back for your comparison charts? Also on the 60 minute chart, do you set CalculateOnBarClose = false to get the updated SMA 200 value for the last bar on the chart? Please also ensure all charts would use the same sessions to be comparable.

    Thanks,
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Are you loading enough days back for your comparison charts? Also on the 60 minute chart, do you set CalculateOnBarClose = false to get the updated SMA 200 value for the last bar on the chart? Please also ensure all charts would use the same sessions to be comparable.

      Thanks,
      Hi Bertrand,

      Both charts are using the same session template and calculateonbarclose = false.

      The 60-minute chart is set to 100 days back but the 1-minute chart is only set to 8 days back. However, shouldn't Ninjatrader automatically pull the required 60-minute bars? Because I used the following code:

      if (CurrentBar < 201 )
      return;
      So shouldn't Ninjatrader pull at least 200 bars for the 60-minute chart? Could you test it on your end....

      Comment


        #4
        No, as you could not programmatically set how much data to load, it would depend on your primary series on the chart - so please try with longer lookbacks to ensure enough historical data to calculate out the 60 min 200 SMA series, then compare the 60 minute 200 SMA with CalculateOnBarClose = false to the 1 min chart running your MultiSeries indicator.

        Thanks,
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        19 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        20 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        180 views
        0 likes
        Last Post jeronymite  
        Working...
        X