OPEN-SOURCE SCRIPT
Schmitt Hysteresis Momentum [forexobroker]

Schmitt Hysteresis Momentum applies a textbook control-theory Schmitt trigger to rate of change. Two ATR-scaled thresholds (one positive, one negative) form a hysteresis band: state flips up only when RoC clears the upper threshold, flips down only when RoC clears the lower. Within a held state, EMA crosses provide entry timing — multiple entries per state without flip-flop.
🔶 ALGORITHM
1. RoC = (close - close[N]) / close[N].
2. Adaptive thresholds: upper = +k * (atr / close); lower = -k * (atr / close).
3. State machine: state := +1 if RoC > upper, -1 if RoC < lower, hold previous otherwise.
4. EMA cross within state direction provides the entry trigger.
🔶 SIGNAL LOGIC
- Buy: state == +1 AND close crosses EMA up AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: state == -1 AND close crosses EMA down.
- Position-lock state machine.
🔶 INPUTS
- RoC Lookback (default 10)
- Pullback EMA Length (default 8)
- Threshold k x ATR Pct (default 0.30)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, EMA toggle, buy / sell colors
🔶 ALERTS
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.
🔶 LIMITATIONS
- Hysteresis prevents flip-flop but slightly lags one-shot regime changes vs single-threshold logic.
- ATR-scaled thresholds are stationarised by atr_pct; very low-volatility periods can leave the state stuck for many bars without entries.
- RoC lookback length affects responsiveness; defaults assume 5m to 1H bars.
- This is a momentum-state engine, not a trend-strength meter; it tells you what regime you are in, not how strong it is.
🔶 ALGORITHM
1. RoC = (close - close[N]) / close[N].
2. Adaptive thresholds: upper = +k * (atr / close); lower = -k * (atr / close).
3. State machine: state := +1 if RoC > upper, -1 if RoC < lower, hold previous otherwise.
4. EMA cross within state direction provides the entry trigger.
🔶 SIGNAL LOGIC
- Buy: state == +1 AND close crosses EMA up AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: state == -1 AND close crosses EMA down.
- Position-lock state machine.
🔶 INPUTS
- RoC Lookback (default 10)
- Pullback EMA Length (default 8)
- Threshold k x ATR Pct (default 0.30)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, EMA toggle, buy / sell colors
🔶 ALERTS
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.
🔶 LIMITATIONS
- Hysteresis prevents flip-flop but slightly lags one-shot regime changes vs single-threshold logic.
- ATR-scaled thresholds are stationarised by atr_pct; very low-volatility periods can leave the state stuck for many bars without entries.
- RoC lookback length affects responsiveness; defaults assume 5m to 1H bars.
- This is a momentum-state engine, not a trend-strength meter; it tells you what regime you are in, not how strong it is.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.