OPEN-SOURCE SCRIPT
MA Narrow State Scanner

This script is a technical scanner specifically designed to find stocks or assets where the short-term trend (20 MA) and the long-term trend (200 MA) have converged significantly. In Oliver Velez's trading strategy, this condition is known as a "Narrow State" and often signals an impending, explosive price move.
How the Script Works
The script calculates the percentage distance between the 20-day moving average and the 200-day moving average. It doesn't check the current live state, but specifically looks at the closing price of the previous trading day.
If the distance is below your defined threshold, the script outputs a signal ("1").
In the Pine Screener, you can use this to filter your favorites list before the market opens to instantly see which stocks closed in a "Narrow State" yesterday.
How to Set the Values
To adjust the settings, click on the indicator name on the chart and select the gear icon (Settings). In the "Inputs" tab, you will find:
Setting Default Value Description
20 MA Length 20 The period for the fast moving average (Velez standard).
200 MA Length 200 The period for the slow moving average (institutional anchor).
Narrow Threshold % 1.0 The most important value. It determines how "close" the MAs must be.
Pro-Tip for Setting the Threshold:
1.0% (Default): Very strict. Finds only stocks where the lines are almost overlapping. Ideal for blue chips like Apple or Disney.
2.0% - 3.0%: A bit looser. Well-suited for more volatile tech stocks or crypto, as these rarely reach a perfect 1% gap.
0.5%: Extremely narrow. Finds only the absolute "coiled springs" (maximum tension).
Daily Application
Open the Pine Screener (at the bottom of TradingView).
Select your Favorites List.
Filter by the indicator result Scan Signal = 1.
Any stocks that appear in the list are in a Velez-style "Narrow State" and are ready for your trading plan today.
How the Script Works
The script calculates the percentage distance between the 20-day moving average and the 200-day moving average. It doesn't check the current live state, but specifically looks at the closing price of the previous trading day.
If the distance is below your defined threshold, the script outputs a signal ("1").
In the Pine Screener, you can use this to filter your favorites list before the market opens to instantly see which stocks closed in a "Narrow State" yesterday.
How to Set the Values
To adjust the settings, click on the indicator name on the chart and select the gear icon (Settings). In the "Inputs" tab, you will find:
Setting Default Value Description
20 MA Length 20 The period for the fast moving average (Velez standard).
200 MA Length 200 The period for the slow moving average (institutional anchor).
Narrow Threshold % 1.0 The most important value. It determines how "close" the MAs must be.
Pro-Tip for Setting the Threshold:
1.0% (Default): Very strict. Finds only stocks where the lines are almost overlapping. Ideal for blue chips like Apple or Disney.
2.0% - 3.0%: A bit looser. Well-suited for more volatile tech stocks or crypto, as these rarely reach a perfect 1% gap.
0.5%: Extremely narrow. Finds only the absolute "coiled springs" (maximum tension).
Daily Application
Open the Pine Screener (at the bottom of TradingView).
Select your Favorites List.
Filter by the indicator result Scan Signal = 1.
Any stocks that appear in the list are in a Velez-style "Narrow State" and are ready for your trading plan today.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.