Quantcast

quantmod newTA

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

quantmod newTA

嗒昵昵
hi all,
I write three indicators in quantmod,but addFI() doesn't work.
R version 2.10.1 in gentoo
Thank you!

library("quantmod")
library("RMySQL")

force=function(x) {
  return((EMA(Cl(x),n=2)-EMA(lag(Cl(x),1),n=2))*Vo(x))
     }
bull=function(x) {
  return(Hi(x)-EMA(Cl(x)))
  }
bear=function(x) {
  return(Lo(x)-EMA(Cl(x)))
  }
addFI=newTA(force,col='blue',type='l')
addBU=newTA(bull,legend.name="Bull",col='white',type='h')
addBE=newTA(bear,legend.name="Bear",col='white',type='h')
        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Loading...