Displaying 1 result from an estimated 1 matches for "addsma".
Did you mean:
addsmb
2012 Sep 04
1
Producing a SMA signal when closing price is above the moving average for 3 days
...mple Moving Average of the closing
price
GEsma[is.na(GEsma)] <- 50 # Make NA's to 50 so ifelse statement works
correctly
aboveSMA <- ifelse(GE$GE.Close > GEsma, 1, 0) # 1 when price is above 50
day moving average
# 0 When below moving average
chartSeries(GE) # Shows Price chart
addSMA(n=50) # adds 50 day moving average to chart