Advances in Financial Machine Learning, Snippet 2.4, page 39. The Symmetric Dynamic/Fixed CUSUM Filter.
cusum_filter(price, threshold, return_datetime = TRUE)
| price | vector of prices | 
|---|---|
| threshold | scalar or numeric vector of same size as price. When the change is larger than the threshold, the function captures it as an even | 
| return_datetime | Should the function return datetime object or index of cusum filter | 
vector of cusum events or datetime of cusum events