how can i buy and finish a operation in quantmod ?

How can i buy when rsi(2) are under 25 and sell on the max of the previus candle?


library(quantmod)
library(TTR)
library(data.table)
library(ggplot2)

getSymbols("EQTL3.sa", src = "yahoo" )
startdate <- as.Date("2019-01-01")
enddate <- as.Date("2022-01-01")

chartSeries(EQTL3.SA, TA=NULL)
addRSI(n= 2)
       
EQTL3.SA <- as.data.frame(EQTL3.SA)
ifr2 <- RSI(EQTL3.SA$EQTL3.SA.Open, n = 2)

TradeRule <- ifelse(ifr2$rsi < 25, 1, 0)

EQTL3.SA$compra <- TradeRule$rsi
1 Like

Seems a somewhat niche interest.
Perhaps engage with the package creators/users at Issues · joshuaulrich/TTR (github.com)