OPEN-SOURCE SCRIPT
20MA / 200 MA Konvergenz & Elephant Bar Filter

The script creates a Momentum Filter designed to identify stocks that are currently exhibiting a transition from long-term price stability to short-term explosive volatility.
1. 🧘 Long-Term Stability Logic (Convergence)
The first part of the script identifies assets in a state of tight consolidation. This suggests that market participants have reached a temporary equilibrium, creating pent-up energy for a future trend.
A. Moving Average (MA) Proximity
The script checks if the fast MA (20 periods) and the slow MA (200 periods) are very close together.
It calculates the percentage difference, filtering for stocks where the separation between the two MAs is less than 2%. This defines the narrow range.
This condition confirms that the short-term and long-term price trends are essentially flat and aligned.
B. Price Nearness to the Long-Term MA
It further ensures that the current closing price is also within a tight range (e.g., less than 2%) of the 200-period MA.
This confirms the asset is actively trading at the center of the consolidation zone, simulating the "parallel" alignment of the MAs.
2. 💥 Explosive Breakout Logic (The Large Candle)
The second part of the script looks for the catalyst—an event that signals a sudden shift in supply and demand, ending the period of calm.
A. Above-Average Body Size
The script calculates the average absolute size of the candle body (the distance between open and close) over the last 20 periods.
It filters for stocks where the current candle body is at least three times (3x) larger than that historical average. This is the core signal of a powerful, convinced price move.
B. High Body-to-Range Ratio
To ensure the move was decisive and met little resistance, the script verifies that the candle body accounts for at least 85% of the candle's total range (high minus low).
This eliminates candles with long wicks (shadows), which would indicate volatility but a lack of directional conviction.
🎯 Summary
The combined screening identifies assets that have maintained long-term stability (MA convergence) but have just experienced a high-conviction, low-resistance breakout (Large Candle), indicating that a new, strong trend may be initiating.
1. 🧘 Long-Term Stability Logic (Convergence)
The first part of the script identifies assets in a state of tight consolidation. This suggests that market participants have reached a temporary equilibrium, creating pent-up energy for a future trend.
A. Moving Average (MA) Proximity
The script checks if the fast MA (20 periods) and the slow MA (200 periods) are very close together.
It calculates the percentage difference, filtering for stocks where the separation between the two MAs is less than 2%. This defines the narrow range.
This condition confirms that the short-term and long-term price trends are essentially flat and aligned.
B. Price Nearness to the Long-Term MA
It further ensures that the current closing price is also within a tight range (e.g., less than 2%) of the 200-period MA.
This confirms the asset is actively trading at the center of the consolidation zone, simulating the "parallel" alignment of the MAs.
2. 💥 Explosive Breakout Logic (The Large Candle)
The second part of the script looks for the catalyst—an event that signals a sudden shift in supply and demand, ending the period of calm.
A. Above-Average Body Size
The script calculates the average absolute size of the candle body (the distance between open and close) over the last 20 periods.
It filters for stocks where the current candle body is at least three times (3x) larger than that historical average. This is the core signal of a powerful, convinced price move.
B. High Body-to-Range Ratio
To ensure the move was decisive and met little resistance, the script verifies that the candle body accounts for at least 85% of the candle's total range (high minus low).
This eliminates candles with long wicks (shadows), which would indicate volatility but a lack of directional conviction.
🎯 Summary
The combined screening identifies assets that have maintained long-term stability (MA convergence) but have just experienced a high-conviction, low-resistance breakout (Large Candle), indicating that a new, strong trend may be initiating.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.