OPEN-SOURCE SCRIPT
Emac ML Adaptive Crossover

The HDAlgos EMAC ML Adaptive Crossover is an adaptive trend reading and crossover system that uses a lightweight machine learning style scoring engine to detect regime shifts in the market. It blends multiple normalised technical features and automatically adjusts EMA lengths based on the detected market regime.
How it works
Feature Engine
The script computes several normalised indicators including RSI, ATR percentage, and Rate of Change. Each feature is converted into a z score so that the values behave consistently across different markets and timeframes. These feature values are then averaged to form a composite regime score.
Regime Detection
The composite score is compared to a dynamic upper and lower threshold. If the score rises above the upper boundary the regime becomes bullish. If the score falls below the lower boundary it becomes bearish. If it stays between the two boundaries the market is classified as neutral.
Adaptive EMAs
The fast and slow EMA lengths are automatically adjusted depending on the detected regime.
• In bullish regimes the fast and slow EMAs shorten.
• In bearish regimes they lengthen.
• In neutral regimes they revert to their base lengths.
This creates an EMA crossover system that responds to market volatility and directional strength rather than using fixed lookback values.
Crossovers
When the adaptive fast EMA crosses above the adaptive slow EMA, a bullish signal appears. When it crosses below, a bearish signal appears.
Visual Aids
• The fast EMA changes color to reflect the current regime.
• Candles can be optionally painted in regime colors.
• A label on the last bar shows the detected regime, score, and active EMA lengths.
• A compact table can be shown in the corner summarizing regime state and metrics.
Alerts
Alerts trigger when the regime changes, when a bullish adaptive crossover occurs, and when a bearish adaptive crossover occurs.
What it is designed for
This indicator is built for traders who want a crossover system that adapts to real market conditions instead of reacting to fixed length EMAs. It provides:
Smoother identification of trend phases
Dynamic sensitivity during strong conditions
Dampened reactions during noise and low conviction periods
Clear and simple signals that remain easy to interpret
How it works
Feature Engine
The script computes several normalised indicators including RSI, ATR percentage, and Rate of Change. Each feature is converted into a z score so that the values behave consistently across different markets and timeframes. These feature values are then averaged to form a composite regime score.
Regime Detection
The composite score is compared to a dynamic upper and lower threshold. If the score rises above the upper boundary the regime becomes bullish. If the score falls below the lower boundary it becomes bearish. If it stays between the two boundaries the market is classified as neutral.
Adaptive EMAs
The fast and slow EMA lengths are automatically adjusted depending on the detected regime.
• In bullish regimes the fast and slow EMAs shorten.
• In bearish regimes they lengthen.
• In neutral regimes they revert to their base lengths.
This creates an EMA crossover system that responds to market volatility and directional strength rather than using fixed lookback values.
Crossovers
When the adaptive fast EMA crosses above the adaptive slow EMA, a bullish signal appears. When it crosses below, a bearish signal appears.
Visual Aids
• The fast EMA changes color to reflect the current regime.
• Candles can be optionally painted in regime colors.
• A label on the last bar shows the detected regime, score, and active EMA lengths.
• A compact table can be shown in the corner summarizing regime state and metrics.
Alerts
Alerts trigger when the regime changes, when a bullish adaptive crossover occurs, and when a bearish adaptive crossover occurs.
What it is designed for
This indicator is built for traders who want a crossover system that adapts to real market conditions instead of reacting to fixed length EMAs. It provides:
Smoother identification of trend phases
Dynamic sensitivity during strong conditions
Dampened reactions during noise and low conviction periods
Clear and simple signals that remain easy to interpret
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
hdalgos.com for Trade Analysis and Indicators
Developed by former Goldman Sachs Trader
Developed by former Goldman Sachs Trader
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
hdalgos.com for Trade Analysis and Indicators
Developed by former Goldman Sachs Trader
Developed by former Goldman Sachs Trader
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.