// RSI Calculation price = close vrsi = ta.rsi(price, length)
// Timeframe filter inDateRange = (time >= startDate and time <= endDate)
// Conditions buyCondition = ta.crossover(vrsi, overSold) and inDateRange sellCondition = ta.crossunder(vrsi, overBought) and inDateRange
// Entry and exit logic if buyCondition strategy.entry("Buy", strategy.long)
if sellCondition strategy.close("Buy")
// Plot RSI for visual reference plot(vrsi, title="RSI", color=color.blue) hline(overSold, "Lower Band (Buy)", color=color.green) hline(overBought, "Upper Band (Sell)", color=color.red) bgcolor(inDateRange ? na : color.new(color.gray, 90), title="Out of Date Range")