I’m working on a trading app and I’m trying to determine the record of consecutive positive or negative trades based on user-selected dates.
I have a list of trades where each trade can result in a positive or negative value. I’ve already implemented a provisional solution using counters, but this only works when the user enters trade data. However, it doesn’t help me when I want to check the streak within a specific date range.
I need to find the streak of consecutive positive trades (before encountering a negative trade) within the dates specified by the user, directly from the database.
I’ve searched extensively for a solution but haven’t found one. Any help or guidance would be greatly appreciated. Thank you!