Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multitimeframe Indicator not "showing" last candle

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

    Multitimeframe Indicator not "showing" last candle

    Hi
    I have this simple code:

    Code:
     protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "TheStratTFC";
    Calculate = Calculate.OnPriceChange;
    IsOverlay = true;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    }
    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Month, 1);
    AddDataSeries(Data.BarsPeriodType.Week, 1);
    AddDataSeries(Data.BarsPeriodType.Day, 1);
    AddDataSeries(Data.BarsPeriodType.Minute, 240);
    AddDataSeries(Data.BarsPeriodType.Minute, 60);
    AddDataSeries(Data.BarsPeriodType.Minute, 30);
    
    }
    
    }
    
    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 0)
    {
    Print("Month: " + MonthOpen + " Week:" + WeekOpen + " Day:" + DayOpen +" 4 Hour: "+Hour4+" Hour:"+Hour+" 30 min:"+Minute30);
    }
    
    if (BarsInProgress == 1)//Month
    {
    MonthOpen = Opens[1][0];
    }
    if (BarsInProgress == 2)//Week
    {
    //WeekOpen = BarsArray[2].GetOpen(BarsArray[2].Count - 1);
    WeekOpen = Opens[2][0];
    }
    if (BarsInProgress == 3)//Day
    {
    DayOpen = Opens[3][0];
    }
    if (BarsInProgress == 4)//4 Hour
    {
    Hour4 = Opens[4][0];
    }
    if (BarsInProgress == 5)//Hour
    {
    Hour = Opens[5][0];
    }
    if (BarsInProgress == 6)//Minute 30
    {
    Minute30 = Opens[6][0];
    }
    
    
    }
    but the last candle on the different timeframes is not registred so the last values I get for all timeframes besides the primary is the candle before the last.

    Best Regards,
    Sune

    #2
    Hello Sune,

    The bars update based on the Calculate setting, and depend on if the data is historical or real-time.

    What is the value of Calculate in State.Configure?

    Is this State.Historical or State.Realtime data?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea

      I do not understand what you are pointing to. Could you elaborate ?

      Best Regards,
      Sune

      Comment


        #4
        Hello Sune,

        Below is a link to the help guide on the Calculate setting.
        https://ninjatrader.com/support/help.../calculate.htm

        And the State property.
        https://ninjatrader.com/support/help.../nt8/state.htm

        As well as a forum thread that discusses how historical data is processed before real-time data.
        https://ninjatrader.com/support/foru...442#post782442
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Again
          Now it works without me changing anything so seems to have been some caching or the like on the chart. Thanks for your help.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Byndhwkfrs, Today, 02:29 AM
          0 responses
          3 views
          0 likes
          Last Post Byndhwkfrs  
          Started by slenderketodiet, Today, 01:57 AM
          0 responses
          3 views
          0 likes
          Last Post slenderketodiet  
          Started by slenderketodiet, Today, 01:56 AM
          0 responses
          1 view
          0 likes
          Last Post slenderketodiet  
          Started by MarilySchwab, Today, 01:32 AM
          0 responses
          1 view
          0 likes
          Last Post MarilySchwab  
          Started by roseiany, Today, 01:29 AM
          0 responses
          1 view
          0 likes
          Last Post roseiany  
          Working...
          X