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