R-Sample Cycle analyze of time series data

Job ID: 34173852

Budget: €30 – €250 EUR

Could somebody please program me an sample R-Code to find cycles in stock data.

Therefore I need an sample with that main functions:
1. Load time series data, see sample below
2. Detrending that data with the Hodrick and Prescott filter
3. Cycle Detection with the Goertzel algorithm (First and second main cycle)
4. Cycle Validation with Bartels test

Please use that function to load the data:
#install.packages('quantmod')
require(quantmod)
getSymbols("MSFT")
close <- MSFT$MSFT.Close
ts.plot(close)

The three functions are in detailed described here: https://cycles.org/wp-content/uploads/2020/03/CycleScanner_Whitepaper_FSC.pdf

Btw. I am using the R-Version 3.6.3 and I cannot upgrade it.
Related categories: Statistics R Programming Language