KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ How to use scan to obtain cumulative value of a function Reply To: How to use scan to obtain cumulative value of a function

  • rgiu70

    Member
    October 23, 2024 at 4:20 pm

    Thank you for your response. My problem is that in the case of 2024.01.04, the low is below the levels 1.09385, 1.0939, 1.09395, so the cumulative list should remove those values from the 2024.01.05, according to the function’s logic. However, if those levels were not crossed upwards or downwards, they should be maintained. This is what I’m not able to achieve.

    To recap:

    The column of cumulative values must accumulate the list of levels, but when high or low exceeds a certain level, it must be removed from the list. If a level generated on the first trading day is never touched, then it must remain in the ‘cumulative’ list until it is touched.