Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 CortexZenUSA, Today, 12:53 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        5 views
        0 likes
        Last Post usazencortex  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,266 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X