Documentos de Académico
Documentos de Profesional
Documentos de Cultura
AUTOMATIZADA “TAV2-ST-QQE”
LINK DEL VIDEO PARA ESTE CÓDIGO:
https://www.youtube.com/watch?v=el1cpqSK4YM
//@version=5
indicator("TAV2-ST-QQE", shorttitle = "AV2STQQE", overlay = true)
//INDICATOR CREATED BY ANDRES ARISTIZABAL, 14 MAY 2022
//
————————————————————————————————————————
————————————————————————————————————————
// I.2. Settings, Function definition
——————————————————————
//
————————————————————————————————————————
————————————————————————————————————————
if input_ma_type == "EMA"
result := ta.ema(input_source, input_ma_period)
result
if input_ma_type == "SMA"
result := ta.sma(input_source, input_ma_period)
result
if input_ma_type == "SWMA"
result := ta.swma(input_source)
result
if input_ma_type == "VWMA"
result := ta.vwma(input_source, input_ma_period)
result
if input_ma_type == "WMA"
result := ta.wma(input_source, input_ma_period)
result
result
//
————————————————————————————————————————
————————————————————————————————————————
// II.1. Calculations, MA — — — — — — — — — — — — — — — — — — — — — — — —
————
//
————————————————————————————————————————
————————————————————————————————————————
//
————————————————————————————————————————
————————————————————————————————————————
// II.2. Calculations, Heikin Ashi
————————————————————————
//
————————————————————————————————————————
————————————————————————————————————————
ha = ticker.heikinashi(syminfo.tickerid)
ha_o = request.security(ha, timeframe.period, o)
ha_c = request.security(ha, timeframe.period, c)
ha_h = request.security(ha, timeframe.period, h)
ha_l = request.security(ha, timeframe.period, l)
//
————————————————————————————————————————
————————————————————————————————————————
// II.3. Calculations, MA (Smoothing)
——————————————————————
//
————————————————————————————————————————
————————————————————————————————————————
//
————————————————————————————————————————
————————————————————————————————————————
// III.1. Display, Colors
————————————————————————————
//
————————————————————————————————————————
————————————————————————————————————————
//
————————————————————————————————————————
————————————————————————————————————————
// III.2. Display, Plotting & Filling — — — — — — — — — — — — — — — — — — — — —
—
//
————————————————————————————————————————
————————————————————————————————————————
//
Wilders_Period = RSI_Period * 2 - 1
Rsi = ta.rsi(src, RSI_Period)
RsiMa = ta.ema(Rsi, SF)
AtrRsi = math.abs(RsiMa[1] - RsiMa)
MaAtrRsi = ta.ema(AtrRsi, Wilders_Period)
dar = ta.ema(MaAtrRsi, Wilders_Period) * QQE
longband = 0.0
shortband = 0.0
trend1 = 0
DeltaFastAtrRsi = dar
RSIndex = RsiMa
newshortband = RSIndex + DeltaFastAtrRsi
newlongband = RSIndex - DeltaFastAtrRsi
longband := RSIndex[1] > longband[1] and RSIndex > longband[1] ?
math.max(longband[1], newlongband) : newlongband
shortband := RSIndex[1] < shortband[1] and RSIndex < shortband[1] ?
math.min(shortband[1], newshortband) : newshortband
cross_1 = ta.cross(longband[1], RSIndex)
trend := ta.cross(RSIndex, shortband[1]) ? 1 : cross_1 ? -1 : nz(trend[1], 1)
FastAtrRsiTL = trend == 1 ? longband : shortband
////////////////////
//
// Zero cross
QQEzlong = 0
QQEzlong := nz(QQEzlong[1])
QQEzshort = 0
QQEzshort := nz(QQEzshort[1])
QQEzlong := RSIndex >= 50 ? QQEzlong + 1 : 0
QQEzshort := RSIndex < 50 ? QQEzshort + 1 : 0
//
Zero = hline(0, color=color.white, linestyle=hline.style_dotted, linewidth=1)
////////////////////////////////////////////////////////////////
//
Wilders_Period2 = RSI_Period2 * 2 - 1
DeltaFastAtrRsi2 = dar2
RSIndex2 = RsiMa2
newshortband2 = RSIndex2 + DeltaFastAtrRsi2
newlongband2 = RSIndex2 - DeltaFastAtrRsi2
longband2 := RSIndex2[1] > longband2[1] and RSIndex2 > longband2[1] ?
math.max(longband2[1], newlongband2) : newlongband2
shortband2 := RSIndex2[1] < shortband2[1] and RSIndex2 < shortband2[1] ?
math.min(shortband2[1], newshortband2) : newshortband2
cross_2 = ta.cross(longband2[1], RSIndex2)
trend2 := ta.cross(RSIndex2, shortband2[1]) ? 1 : cross_2 ? -1 : nz(trend2[1], 1)
FastAtrRsi2TL = trend2 == 1 ? longband2 : shortband2
//
// Zero cross
QQE2zlong = 0
QQE2zlong := nz(QQE2zlong[1])
QQE2zshort = 0
QQE2zshort := nz(QQE2zshort[1])
QQE2zlong := RSIndex2 >= 50 ? QQE2zlong + 1 : 0
QQE2zshort := RSIndex2 < 50 ? QQE2zshort + 1 : 0
//
//SIGNALS
long_signal = ha_o <= ha_c and buy1 [1] > sell1 [1] and RsiMa2 - 50 > ThreshHold2 and
RsiMa - 50 > upper
short_signal = ha_o >= ha_c and buy1 [1] < sell1 [1] and RsiMa2 - 50 < 0 - ThreshHold2 and
RsiMa - 50 < lower
//ALERTS
alertcondition(long_signal, title = "AV2STQQE LARGO", message = "LONG")
alertcondition(short_signal, title = "AV2STQQE CORTO", message = "SHORT")