search for: gesma

Displaying 1 result from an estimated 1 matches for "gesma".

Did you mean: mesma
2012 Sep 04
1
Producing a SMA signal when closing price is above the moving average for 3 days
...le moving average for 3 days and I want it to keep the 1 until the price moves back below the 50 day simple moving average for 3 days then I want to return a 0 until the Price closes above the SMA for 3 days. Thank you, Douglas library(quantmod) getSymbols("GE") # Get Price Data GEsma <- SMA(GE$GE.Close, n=50) # Simple 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 ch...