0
quantstrat에 맞춤형 표시기를 추가하고 싶지만이 표시기는 가격 시리즈에서 계산되지 않습니다. 예 :표시기 추가 Quantstrat R
# Get SPY from Yahoo Finance
getSymbols("SPY", from = "2016-01-01", to = "2016-01-31", src = "yahoo", adjust = TRUE)
SPY <- SPY[,1:4]
#Create Indicator
set.seed(123)
indicator <- sample(seq(from = 0, to = 100, by = 5), size = nrow(SPY), replace = TRUE)
전략에 표시기를 추가하고 신호를 생성하려면 어떻게해야합니까? 내가 발견 한 것은 지표를 추가하는 기본 표기법이지만 이미 계산 된 지표를 추가 할 수 있습니까?
# Add a 5-day simple moving average indicator to your strategy
add.indicator(strategy = strategy.st,
# Add the SMA function
name = "SMA",
# Create a lookback period
arguments = list(x = quote(Cl(mktdata)), n = 5),
# Label your indicator SMA5
label = "SMA5")