OPEN-SOURCE SCRIPT
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
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.