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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        63 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        92 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        48 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        106 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        63 views
        0 likes
        Last Post PaulMohn  
        Working...
        X