Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Renko bars directional bar time

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Renko bars directional bar time

    I'm trying to create an indicator that measures the time it takes to complete a non-time based bar such as renko or range, but calculate up-close bars separately from down close bars so that I can then calculate the mean time of each over a certain lookback period.

    This code works fine for showing up-bar time lengths, but when I try to apply indicators to it, such as a 10 bar SMA, the SMA returns the SMA of price, not time.

    I'm sure it's something simple, but I've been unable to solve. Many thanks.


    protected override void OnBarUpdate()
    {
    if (CurrentBar<1)
    return;
    if (Close[0] < Open[0])
    return;

    DateTime eTime, pTime;
    if (Bars.FirstBarOfSession)
    Bars.Session.GetNextBeginEnd(Time[0],out pTime,out eTime);
    else
    pTime = Time[1];

    TimeSpan span = Time[0].Subtract(pTime);
    TimePast.Set(span.TotalMinutes);
    }

    #2
    Hello Sparkyboy

    Please ensure to only post your question once, It looks like this is a duplicate question from your other thread: https://ninjatrader.com/support/foru...d.php?t=111418

    As the other thread is being replied to, I will close this thread.

    I look forward to being of further assistance.

    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