Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceEntry() used to find minutes of time since entry

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

    BarsSinceEntry() used to find minutes of time since entry

    Hi,

    Through the forum I have found the method of calculating an interval of time in minutes. However, the forum notes that BarsSinceEntry() is a more eloquent solution but how do I find out how long a bar is in minutes, so that I can do a test such as, are we 5 minutes since entry? That is, I could be running an algo on 1 minute or 30 minute time frame and the BarsSinceEntry() will not be the same in terms of time elapsed obviously. I believe the time version would be something like:

    DateTime time1 = Time[BarsSinceEntry()];
    DateTime time2 = Time[0];
    TimeSpan interval = time2 - time1;
    double minsSinceEntry = interval.TotalMinutes;

    Cheers,
    darmbk.

    #2
    Hello darmbk,

    You may use the "BarsPeriod.Value" to get the number of minute on each bar.

    JCNinjaTrader Customer Service

    Comment


      #3
      Hi - i followed the link but those commands dont seem to work for Renko - if i wanted to state that if minutes since entry are greater than 20 - is there an easy way to formulate that statement for renko

      Comment


        #4
        Originally posted by hifreq View Post
        Hi - i followed the link but those commands dont seem to work for Renko - if i wanted to state that if minutes since entry are greater than 20 - is there an easy way to formulate that statement for renko
        You cannot use the bar Time as a proxy for the order execution time: they are fundamentally independent concepts. If you want to know the time of execution, query it as a property of the IOrder.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kinfxhk, 07-14-2026, 09:39 AM
        0 responses
        123 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        104 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        82 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        102 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        83 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X