-
Notifications
You must be signed in to change notification settings - Fork 3
using function onedayaheadprediction
8 packages to load to use onedayaheadprediction. These are TSA,quantmod,rugarch,lmtest, moments,forecast,fGarch and tseries.
#getSymbols(“ABC”, from=“1900-01-01”)to download data of ABC stock.
O<-Op(TATASTEEL.NS)
C<-Cl(TATASTEEL.NS)
P<-(O+C)/2
ret<-na.trim( ROC )
#na.trim( ROC ) ) is useful to get return and this matrix will be input to fitg <-garchFit(~ garch(1, 1), data = “return matrix”, trace = FALSE, cond.dist=“QMLE”)
p<-predict(fitg,n.ahead=1,plot=TRUE,conf=.9,nx=100)
STRATEGY
1# onedayaheadprediction(Op(ABC),Cl(ABC)) gives the predicted value of open and close
2# If open>close and p4<p1<p5 and volume>MA(V,5)
if step 2 is satisfied then buy above predicted open price and sell at predicted close price with stop loss of predicted open price.