Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Look Back based on TIME and not BARs

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

    Look Back based on TIME and not BARs

    I have the chart based on TICK (4 for each bar)
    I am looking for a way to look back for a certain TIME period intraday, (ex. 30min)
    everywhere I look I see this based on counting the bars. but in my case, this does not help as I dont know how many TICK bars in one minute, its dynamic and changes with instrument

    hope its clear

    #2
    Hello dadarara,

    Thanks for your post.

    Correct, tick bars are not time based and there is no consistent number of bars per time unit.

    One approach you might consider is using GetBar(). this method will provide the bar number of the closest bar that fits the time specified. This would give you a 30 minute reference point and would provide the number of bars in that particular 30 minute period.

    Reference: http://ninjatrader.com/support/helpG...us/?getbar.htm

    Here is an example:

    int StartBar = Bars.GetBar(Time[0].AddMinutes(-30));

    Where the example integer StartBar will contain the bar number from 30 minutes ago. You can then determine the number of bars in the look back period by:

    int BarsToProcess = CurrentBar - StartBar;

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X