Hello @twopirllc and @KilianB
I am making this pr to solve the issue @KilianB reported in #761 some hours ago.
The problem happens when there's two extremums in a single candle, e.g. we can see local max and min in 2021-09-07 00:00:00 candle.
To handle this, I simply continued the code when this situation happens and as a result, one of the two consecutive swings disappear:
@twopirllc kindly find the better solution and if you needed any guidance with the code I wrote, do not hesitate to let me know. I also made another local branch in my fork and then made this pr, so you can consider whether or not close the previous pr #761
To explain more about code components, there are three functions: First I defined a rolling window function np_rolling_hl to find local min/max according to window_size value in input. In second function np_find_zigzags, I do the main job of finding zigzag values based on looking backwards to the candles (from the last candle to the first one). In the third function map_zigzag, I just mapped the index (and value) of zigzag points into the whole data vector.
Excellent! Thanks for quickly responding and providing a fix. Will review and merge it as soon as I can with other PRs. Wish I had more time! 😅 I appreciate all your help. 😎
Hello @twopirllc and @KilianB I am making this pr to solve the issue @KilianB reported in #761 some hours ago. The problem happens when there's two extremums in a single candle, e.g. we can see local max and min in
2021-09-07 00:00:00
candle. To handle this, I simply continued the code when this situation happens and as a result, one of the two consecutive swings disappear:@twopirllc kindly find the better solution and if you needed any guidance with the code I wrote, do not hesitate to let me know. I also made another local branch in my fork and then made this pr, so you can consider whether or not close the previous pr #761
To explain more about code components, there are three functions: First I defined a rolling window function
np_rolling_hl
to find local min/max according towindow_size
value in input. In second functionnp_find_zigzags
, I do the main job of finding zigzag values based on looking backwards to the candles (from the last candle to the first one). In the third functionmap_zigzag
, I just mapped the index (and value) of zigzag points into the whole data vector.