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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X