Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

reset variable by time

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

    reset variable by time

    Hello everyone, help to reset variable by time

    using the code for day reset:

    if (Bars.IsFirstBarOfSession)
    {
    Reset_Volume = 0;
    }

    How to make the variable reset, for example, every 60 minutes.

    Specific example with syntax

    #2
    You can use ToTime(Times[0][0]) to track and set condition on it.
    ** ToTime(Times[0][0]) is just a guide for you, you can explore more about it.

    Comment


      #3
      Hi memonolog,
      if (Times[1][0].Hour != Times[1][1].Hour)
      {
      Do something // Provides updates at the turn of the FULL hour (03.00, 04.00, 05.00).
      }
      Watch-out If trading hours do not start at the full hour (e.g. 2.15 a.m for FDAX), you will have to use/add a data series small enough to ensure one bar ends at the FULL hour (e.g. 1 min, 5 min, 15 min) and then apply the above code to that time series, if you wanted to grab some data points at the turn of the full hour.
      NT-Roland

      Comment


        #4
        Originally posted by cincai View Post
        You can use ToTime(Times[0][0]) to track and set condition on it.
        ** ToTime(Times[0][0]) is just a guide for you, you can explore more about it.
        Hi memonolog,
        if (Times[1][0].Hour != Times[1][1].Hour)
        {
        Do something // Provides updates at the turn of the FULL hour (03.00, 04.00, 05.00).
        }
        Watch-out If trading hours do not start at the full hour (e.g. 2.15 a.m for FDAX), you will have to use/add a data series small enough to ensure one bar ends at the FULL hour (e.g. 1 min, 5 min, 15 min) and then apply the above code to that time series, if you wanted to grab some data points at the turn of the full hour.
        NT-Roland
        Thank you friends I will try your options

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by timmbbo, Today, 09:10 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by space_trader, 11-26-2020, 05:06 AM
        2 responses
        164 views
        1 like
        Last Post klaus w
        by klaus w
         
        Started by Kicks.Spin, Today, 07:46 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by Renejm, Today, 06:17 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by kazisl, Yesterday, 06:41 PM
        3 responses
        16 views
        0 likes
        Last Post kazisl
        by kazisl
         
        Working...
        X