I found the following code online
Load historical data
#******************************************************************
#install.packages("quantmod")
library(quantmod)
tickers = 'SPY'
data = getSymbols(tickers, src = 'yahoo', from = '1950-01-01', auto.assign = F)
#*****************************************************************
Euclidean distance, one to one mapping
#******************************************************************
obj = bt.matching.find(Cl(data), normalize.fn = normalize.mean, dist.fn = 'dist.euclidean', plot=T)
matches = bt.matching.overlay(obj, plot.index=1:90, plot=T)
layout(1:2)
matches = bt.matching.overlay(obj, plot=T, layout=T)
bt.matching.overlay.table(obj, matches, plot=T, layout=T)
Error message says "couldn't find function matching.find and bt.matching.overlay
Someone suggested to try SIT here:
That is why I am trying SIT. Thanks.