Create a function to check that trends do not overlap, so the trend which last longer is the one to keep and the otherone is discarded.
For example, inside of a Down Trend between 01/01/2018 and 01/02/2018 there is an Up Trend between 05/01/2018 and 13/01/2018; and as the Down Trend lasts longer, it is expected to be the predominant trend on that market range of dates.
This issue was identified when developing the function identify_all_trends, where an Up Trend was overlapped inside a Down Trend, as shown below:
Create a function to check that trends do not overlap, so the trend which last longer is the one to keep and the otherone is discarded.
For example, inside of a
Down Trend
between 01/01/2018 and 01/02/2018 there is anUp Trend
between 05/01/2018 and 13/01/2018; and as theDown Trend
lasts longer, it is expected to be the predominant trend on that market range of dates.This issue was identified when developing the function
identify_all_trends
, where anUp Trend
was overlapped inside aDown Trend
, as shown below: