Threshold tools flip-flop when momentum hovers on the line. Also, schmitt Hysteresis Momentum, a momentum filter indicator TradingView traders can run as a state filter, borrows a fix from control theory. It sets two thresholds instead of one, and it scales both to ATR percent. Indeed, rate of change above the upper level locks a bull state. Below the lower level it locks a bear state. In between, the last state simply holds.
It is free and open source. Still, you can add it to any chart from the Schmitt Hysteresis Momentum script page on TradingView, and the full Pine source is published there for you to read.
What Schmitt Hysteresis Momentum plots on the price chart
The script plots one line: an 8-period EMA that price pulls back to. Thus, it paints green in the bull state, red in the bear state and grey while the state stays neutral. Square markers with a three-layer glow mark entries, labelled SHM up and SHM dn. Hence, the signal bar takes a solid colour, and a faint background tint runs for as long as the state holds. A top-right dashboard prints rate of change, both thresholds, ATR percent, the state, the position and bars since the last signal.

How Schmitt Hysteresis Momentum is built
The Schmitt trigger idea
A Schmitt trigger is a switch with memory. Next, engineers use it to clean up noisy signals. One threshold turns the switch on. Then, a different, lower threshold turns it off. Between the two levels the output holds whatever it already was. Yet, that gap is the hysteresis band, and it stops rapid chatter around a single level.
This script applies the same trick to momentum. Truly, rate of change measures the percentage move over the last 10 bars. The upper threshold equals 0.30 times ATR percent, where ATR percent divides a 14-period ATR by the current close. Plainly, the lower threshold is the mirror image. So the band widens when the market gets volatile and narrows when it calms down. Also, the state latches at plus one, minus one or zero, and it never resets on its own.
From state to entry
The state alone triggers nothing. Indeed, entries wait for price to cross the 8-period EMA in the direction the state already points. A long needs a bull state plus a close crossing above that EMA. Still, a short needs a bear state plus a close crossing below it. That structure turns the tool into a pullback timer inside a latched regime.
Three gates follow. Thus, every signal checks barstate.isconfirmed, so nothing prints mid-bar. A four-bar cooldown spaces the marks out. Hence, and the position state must flip, so a long cannot follow a long.
That last gate matters more than it sounds. Next, the script header suggests each state can fire several entries. In practice the position flip forces an alternation: one long, then a short, then a long. Then, the Position row on the dashboard tells you which side the script will accept next.
How to read the signals
Start with the state, not the marker. Yet, the background tint tells you which way the trigger latched. A bull tint says rate of change once cleared the upper threshold and has not broken the lower one since. Truly, the state can persist through a long, quiet drift.
Then check ATR percent. Plainly, that single row explains the threshold width. On a calm session ATR percent shrinks, both thresholds tighten, and the state flips more often. On a volatile session the band widens and the state holds longer. Raising k toward 1.0 widens it further at every volatility level.
The EMA cross is the trigger, so entries land after price has already turned. That lag buys confirmation. Shorten the EMA to 3 for quicker marks, or stretch it toward 50 to demand a deeper pullback first.

Every Schmitt Hysteresis Momentum setting explained
The script exposes 9 inputs, grouped in the settings panel exactly as shown below. Defaults are the published values.
Schmitt Trigger
| Setting | What it does | Default | Range |
|---|---|---|---|
| RoC Lookback | Sets the roc lookback used in the calculation. | 10 | 2 to 50 |
Signal Logic
| Setting | What it does | Default | Range |
|---|---|---|---|
| Pullback EMA Length | Sets the pullback ema length used in the calculation. | 8 | 3 to 50 |
| Threshold k x ATR%% | Upper threshold = +k*atr/close. Lower = -k*atr/close. Hysteresis between. | 0.30 | 0.05 to 2.0 |
| Cooldown Bars | Sets the cooldown bars used in the calculation. | 4 | 1 to 20 |
Visual
| Setting | What it does | Default | Range |
|---|---|---|---|
| Show Dashboard | Toggles show dashboard on the chart. | on | on / off |
| Show 3-Layer Glow | Toggles show 3-layer glow on the chart. | on | on / off |
| Show Pullback EMA | Toggles show pullback ema on the chart. | on | on / off |
| Buy Color | Colour used for buy color. | #00e676 | |
| Sell Color | Colour used for sell color. | #ff1744 |

Alerts built into Schmitt Hysteresis Momentum
The script ships 11 alert conditions. Also, open the alert dialog on the chart, pick the indicator as the condition source, then choose the event you want. Alerts fire on the close of the bar, so they follow the same confirmed-bar rule the on-chart signals use.
- SHM Buy
- SHM Sell
- SHM Any Signal
- SHM Bull Lock
- SHM Bear Lock
- SHM Upper Cross
- SHM Lower Cross
- SHM EMA Up
- SHM Webhook JSON
Other markets and timeframes
Every number in this script is relative. Indeed, rate of change comes out as a percentage. The thresholds scale to ATR divided by close, which is also a percentage. Still, nothing references pips, points or contract size, and the script reads no volume at all. So the defaults move to gold, indices, crypto and equities without retuning. Thus, the one setting worth revisiting per market is k. Instruments that trend smoothly suit a narrower band than instruments that whipsaw.

Limitations worth knowing
This is a state filter with an entry trigger. It is not a system. It sets no stop, no target and no position size. Hence, it also holds no opinion on market structure, session timing or higher-timeframe context.
A latched state can go stale. Next, once bull locks in, it holds until rate of change breaks the lower threshold. Price can drift lower for many bars inside the band while the tint still reads bullish. Then, that is the deliberate cost of hysteresis rather than a fault, but you should watch for it.
The ATR period sits fixed at 14 in the code and no input exposes it. Yet, the script also calls no request.security, so it reads a single timeframe only. And the position-flip rule blocks adding to a running direction, so a strong one-way run produces just one mark.
Get Schmitt Hysteresis Momentum on TradingView
Open Schmitt Hysteresis Momentum on TradingView
If you also trade MetaTrader, the MT4 and MT5 indicator library is available below.
Get the complete indicator library
One email unlocks the full MT4 and MT5 indicator library. Truly, this TradingView script stays free on TradingView – the button above adds it to your chart.
Using it alongside MetaTrader
Adding a script on TradingView takes one click, so there is no install step here. Plainly, if you want the same idea on MetaTrader, the MT4 and MT5 indicator installation guide walks through copying files into the data folder and attaching them to a chart. You can also browse the full MetaTrader indicator library, the MT4 indicators section, or the other free TradingView scripts published on this profile. For related chart tools see the MT5 indicators section and the forex trading strategies guides.
External references
- Momentum (finance) on Wikipedia
- ADX at Investopedia
- Raff Regression Channel at StockCharts ChartSchool
Frequently asked questions
Does the Schmitt Hysteresis Momentum indicator repaint?
No. Also, both the buy and the sell condition require barstate.isconfirmed, and the square markers use those same conditions. Nothing prints until the bar closes. Indeed, the state variable also updates on closed bars, so the historical tint matches what you saw live.
What does the hysteresis actually do here?
It creates a dead zone. Still, rate of change must clear plus 0.30 times ATR percent to lock bullish, and it must fall under minus that figure to lock bearish. Anything between the two leaves the previous state untouched. Thus, a single threshold would flip every time momentum grazed the line.
Why do I see only one long per uptrend?
The position state blocks repeats. Hence, a buy needs the position at flat or short first, so the script alternates sides. If you want several entries in one direction, the gate to change is the position rule and not the cooldown.
Which timeframe suits it best?
Any of them, because the thresholds scale with volatility on every chart. Next, fast charts flip the state more often, so raise the cooldown from 4 toward 20 there. Higher timeframes hold a state for long stretches and give you fewer, slower marks.
How much should I rely on this indicator?
Treat it as one input, not a decision. Then, it is a chart analysis tool, not trading advice. Test it on your own markets and timeframes before relying on it. Results are not guaranteed; past performance is not indicative of future results.
