Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

plot values switch to: 0

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

    plot values switch to: 0

    Hello,

    Could some help me understand why my plot values switch to: 0 when I attempt to plot RTH OHL values on any other time frame than a 1 minute chart. When I use a 1 minute chart, the indicator plots just fine.

    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1)
    return;

    if (CurrentBars[0] < 1)
    return;

    if (Time[0].TimeOfDay == RTHStart.TimeOfDay)
    {
    myRTHOpen = Open[0];
    myRTHHigh = High[0];
    myRTHLow = Low[0];
    }

    //if (Times[0][0].TimeOfDay >= new TimeSpan(08, 30, 00) && Times[0][0].TimeOfDay <= new TimeSpan(16,00, 00))
    if (Time[0].TimeOfDay >= RTHStart.TimeOfDay && Time[0].TimeOfDay < RTHEnd.TimeOfDay)
    {
    RTHOpen[0] = myRTHOpen;

    if (High[0] > myRTHHigh)
    {
    myRTHHigh = High[0];
    }

    if (Low[0] < myRTHLow)
    {
    myRTHLow = Low[0];
    }

    RTHHigh[0] = myRTHHigh;
    RTHLow[0] = myRTHLow;
    }
    else
    {
    RTHOpen[0] = RTHOpen[1];
    RTHHigh[0] = RTHHigh[1];
    RTHLow[0] = RTHLow[1];
    }
    Print(Time[0] + "RTHOpen[0] " + RTHOpen[0]);
    }
    Attached Files

    #2
    Hello AdeptistJune,

    Thanks for your post.

    The issue here would be to understand that Tick bars are not based on time so you may or may not have a tick precisely at a time condition such as if (Time[0].TimeOfDay == RTHStart.TimeOfDay) and this means your values may not be getting set.

    I would suggest adding a 1-minute data series so that you always have that timing reference and you may have to consider that with a faster chart data series such as 100 tick, that you could have multiple occurrences where the time match condition is true so you may need additional logic (bool variables) so that your time statement is executed only once per event, this of course means resetting the bools later for the next session.

    When creating a multi time frame indicator you will need to keep these concepts in mind: https://ninjatrader.com/support/help...nstruments.htm

    Comment

    Latest Posts

    Collapse

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