OPEN-SOURCE SCRIPT
MES Trend Regime

Finds the bigger trend with a 50-length HMA
Measures how long past bull and bear trends usually last.
If the current move is likely to “survive” (based on duration stats + threshold), it labels:
Up Regime → bullish environment
Down Regime → bearish environment
Only trades in the direction of that regime
In Up Regime: it will only take longs.
In Down Regime: it will only take shorts.
Uses a 7 EMA / 21 SMA crossover for entries
Long entry when 7 EMA crosses above 21 SMA AND Up Regime is active AND time is within session.
Short entry when 7 EMA crosses below 21 SMA AND Down Regime is active AND time is within session.
Trades only between 06:00 and 11:45 (exchange time)
No new positions are opened outside this window.
Uses stop loss and 2 profit targets in ticks
SL, TP1, and TP2 are all set in ticks off the entry price.
When in a trade:
Half the position exits at TP1.
The other half exits at TP2.
The same stop loss protects the whole position.
Measures how long past bull and bear trends usually last.
If the current move is likely to “survive” (based on duration stats + threshold), it labels:
Up Regime → bullish environment
Down Regime → bearish environment
Only trades in the direction of that regime
In Up Regime: it will only take longs.
In Down Regime: it will only take shorts.
Uses a 7 EMA / 21 SMA crossover for entries
Long entry when 7 EMA crosses above 21 SMA AND Up Regime is active AND time is within session.
Short entry when 7 EMA crosses below 21 SMA AND Down Regime is active AND time is within session.
Trades only between 06:00 and 11:45 (exchange time)
No new positions are opened outside this window.
Uses stop loss and 2 profit targets in ticks
SL, TP1, and TP2 are all set in ticks off the entry price.
When in a trade:
Half the position exits at TP1.
The other half exits at TP2.
The same stop loss protects the whole position.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.