Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi timeframe Weekly + Daily Issue => Friday, Monday...

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

    Multi timeframe Weekly + Daily Issue => Friday, Monday...


    Dears,

    I found out one issue when coding with Multi timeframe. Please see simple code - when activated on Weekly chart:

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "tomTest";
    Calculate = Calculate.OnBarClose;
    IsOverlay = false;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    IsSuspendedWhileInactive = true;
    }
    else if (State == State.DataLoaded)
    {

    }
    else if (State == State.Configure)
    {
    AddDataSeries(BarsPeriodType.Day, 1);
    }
    }

    protected override void OnBarUpdate()
    {
    if(BarsInProgress == 0)
    {
    Print(String.Format("{0} Weekly --------------------------------", Time[0]));
    }
    else
    {
    Print(String.Format("{0} Daily, DayOfWeek={1}", Time[0], Time[0].DayOfWeek));
    }
    }

    Here is result:
    13.05.2022 22:15:00 Weekly --------------------------------
    13.05.2022 22:15:00 Daily, DayOfWeek=Friday
    16.05.2022 22:15:00 Daily, DayOfWeek=Monday
    17.05.2022 22:15:00 Daily, DayOfWeek=Tuesday
    18.05.2022 22:15:00 Daily, DayOfWeek=Wednesday
    19.05.2022 22:15:00 Daily, DayOfWeek=Thursday
    20.05.2022 22:15:00 Weekly --------------------------------
    20.05.2022 22:15:00 Daily, DayOfWeek=Friday
    23.05.2022 22:15:00 Daily, DayOfWeek=Monday
    24.05.2022 22:15:00 Daily, DayOfWeek=Tuesday
    25.05.2022 22:15:00 Daily, DayOfWeek=Wednesday
    26.05.2022 22:15:00 Daily, DayOfWeek=Thursday
    27.05.2022 22:15:00 Weekly --------------------------------
    27.05.2022 22:15:00 Daily, DayOfWeek=Friday
    31.05.2022 22:15:00 Daily, DayOfWeek=Tuesday
    01.06.2022 22:15:00 Daily, DayOfWeek=Wednesday
    02.06.2022 22:15:00 Daily, DayOfWeek=Thursday
    03.06.2022 22:15:00 Weekly --------------------------------

    This doesnt look like good behaviour, what do you think? Ninja processes wrong Friday - starts with friday from previous week and doesnt account Friday from current week. It will be great if this should be fixed. Thanks, best regards

    Tomas


    #2
    Hello Tomas,

    A bar does not fully close until a new tick opens a new bar. The Day bar isn't closing until the first tick of Monday which appears to the start of a new session.

    If you were to run the script with Calculate OnPriceChange or OnEachTick, you could have this update before the bar closes.

    Kind regards.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    633 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    567 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X