简体   繁体   中英

f# Rprovider issues with TTR Package

I don't know if anyone has had any issues with Rprovider and the TTR package. I am currently trying to use the RSI indicator from TTR however each time I call the function, I get the following error:

Additional information: Error in TTR::RSI(price = fsr_9396_17, n = 2) :

could not find function "try.xts"

My code that I am running is below:

let times=  [ "Input"=>timeser
              "RSI2"=>R.RSI(timeser,80).GetValue<Series<_, double>>()] |> frame

If I change RSI to rollmeans then the code works perfectly. If anyone has any experience with solving this problem would be great if they could help.

Thanks.

It seems that the RSI function only works if the xts package is imported before the call. I'm not entirely sure if this is an R provider bug or some non-standard thing in the RSI function, but you can workaround it by explicitly calling library(xts) before:

// Add this to make the following code work
R.eval(R.parse(text="library(xts)"))

// Very basic call to RSI that now works
let timeser = series [ for s in 0.0 .. 100.0 -> DateTime.Now.AddMinutes(s) => s ]
R.try_xts(timeser)
R.RSI(timeser,80)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM