// Final Buy Signal Conditions buy_signal_raw = rsi_condition and ema_condition and price_condition and distance_condition
// Time Filter Logic var float last_signal_time = na // Persistent variable for last signal time is_cooldown_over = na(last_signal_time) or (time - last_signal_time > signal_cooldown * 86400000) // 86400000 ms in a day buy_signal = buy_signal_raw and is_cooldown_over
if buy_signal last_signal_time := time // Update last signal time when a new signal is generated
// Plot EMAs plot(ema20, color=color.blue, title="EMA20") plot(ema50, color=color.orange, title="EMA50")