I am currently trying to back test a strategy on a file which contains minutely data for the whole month. I would like to reset my indicators at 3:30 PM . Is there a way I can reset the indicators based on time or any other way ? Following is the code for adding data and SMA indicator to my strategy . Since the data index is time series , I could use 15:30:00 as an event to reset the SMA indicator . The data contains 1 month of minutely data .

nifty <- as.xts(read.zoo("01122016CE8100.csv", 
                         sep =",", 
                         header = TRUE,
                         format = "%H:%M",
                         tz = ""))
SMA_str <- add.indicator(strategy = SMA_str,
                         name = "SMA",
                         arguments = list(x = quote(Cl(mktdata)), n = 20),
                         label = "SMA")
  • $\begingroup$ Welcome to Quant.SE - could you provide some code and an example because the question is unclear as it stands $\endgroup$
    – vonjd
    Dec 1, 2016 at 17:23
  • 1
    $\begingroup$ Added some more info @vonjd $\endgroup$ Dec 1, 2016 at 17:44


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.