EMA + ADX CLEAN (4H/1D)

ema10_len = input.int(10)
ema21_len = input.int(21)
ema55_len = input.int(55)
ema200_len = input.int(200)
adx_len = input.int(14)
adx_threshold = input.int(25)
// === MÉDIAS ===
ema10 = ta.ema(close, ema10_len)
ema21 = ta.ema(close, ema21_len)
ema55 = ta.ema(close, ema55_len)
ema200 = ta.ema(close, ema200_len)
// === ADX ===
[diplus, diminus, adx] = ta.dmi(adx_len, adx_len)
// === TENDÊNCIA ===
bullTrend = ema10 > ema21 and ema21 > ema55 and ema55 > ema200
bearTrend = ema10 < ema21 and ema21 < ema55 and ema55 < ema200
// === CONDIÇÕES ===
longCondition = ta.crossover(ema10, ema21) and bullTrend and adx > adx_threshold
shortCondition = ta.crossunder(ema10, ema21) and bearTrend and adx > adx_threshold
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.