Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Count last 30 values

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

    Count last 30 values

    I want to keep a count of the 30 last instances where the spread between the swing high and swing low is > 10.

    Counting isn't the problem but how would I count only the last 30 instances?

    if SwingHigh - SwingLow > 10
    count++ // how would I count only the last 30 instances

    Any ideas would be appreciated.

    #2
    Hello sdauteuil,

    Thanks for your post.

    Can you provide further information or context on what you are looking for here? It is not clear what you are doing with the 30 instances.

    Are you saving bar numbers of each high/low point?



    Comment


      #3
      Basically my end goal is to create a ratio

      example


      // let's say over the last 30 times there was a new Swing High and during this period there were 12 instances where the SwingHigh - SwingLow was > 10 (where the price distance between the last swing low and current swing high is greater that 10 points)

      ratio = 12 / 30

      Hope that makes sense



      Last edited by sdauteuil; 08-02-2021, 12:41 PM.

      Comment


        #4
        Hello sdauteuil,

        Thanks for your reply.

        I think that to accomplish your goal you would need a C# list that is 30 long and in that list, you store the 30 values of swing high to swing low, as they occur. As a new swing high is found then that last one is removed from the list, keeping you with the latest 30. As needed, or when you add a new swing high, you can determine the new ratio by looping through the list of numbers and counting those > 10.

        I do not have any examples of this but recommend that you search C# tutorials online for List processing. Here is one that may help: https://csharp.net-tutorials.com/collections/lists/

        We can leave this thread open for any other members that may be able to provide further advice/suggestions on this subject.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        24 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        120 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        63 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        45 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X