indicator · own pane · open source

Market Trend Strength

Deepwick · @deepwickv1Updated 2 Oct 2026▲ 0 users
Running…
Loading chart…

About

Market Trend Strength measures how often consecutive bars move the same direction over a window, as a percentage. Above 50 = persistence, below = chop.

  • Values above ~60 = strong trend persistence; below ~40 = the market keeps flipping on itself.
  • Use to filter mean-reversion vs trend-following strategies.

Source code

//@version=5
indicator("Market Trend Strength", overlay=false)
len = input.int(14, "Length", minval=2)
mts = math.sum((math.sign(ta.change(close)) == math.sign(ta.change(close)[1]) ? 1 : 0), len) / len * 100
hline(50, "Persistence floor", color=color.gray, linestyle=hline.style_dashed)
p_MTS = plot(mts, "MTS", color=mts >= 50 ? color.green : color.red, linewidth=2)
alertcondition(ta.crossover(mts, 60), "MTS enters trending", "Market Trend Strength crossed above 60")
alertcondition(ta.crossunder(mts, 40), "MTS enters chop", "Market Trend Strength dropped below 40")

Comments

No comments yet.

Sign in to comment.