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 open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
🔵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.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
🔵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.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.