FieryTrading: Buy The Dip - Sell The Rip
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © FieryTrading

//@version=5
indicator("FieryTrading BTD - STR", overlay=true)


/// RSI
rsi = ta.rsi(close, 14)
smooth_len = input.int(3, "RSI Smoothing")
smooth_rsi = ta.sma(rsi,smooth_len)

/// MTF SMA
sma_res = input.timeframe('W', "MTF Resolution")
mtf_len = input.int(20, "MTF Length")
rp_security(_symbol, _mtflen, _src) =>
    request.security(_symbol, _mtflen, _src[barstate.isrealtime ? 1 : 0])
mtf_sma = rp_security(syminfo.tickerid, sma_res, ta.sma(close, 20))

/// Entry conditions
long = smooth_rsi<30 and smooth_rsi>smooth_rsi[1] and close>mtf_sma
short = smooth_rsi>70 and smooth_rsi<smooth_rsi[1] and close<mtf_sma

/// Plots & Alerts
plotshape(long and not long[1], style = shape.triangleup, color=color.green, size=size.small, location = location.belowbar)
plotshape(short and not short[1], style = shape.triangledown, color=color.red, size=size.small, location = location.abovebar)
alertcondition(long and not long[1], "Long Entry")
alertcondition(short and not short[1], "Short Entry")




