OPEN-SOURCE SCRIPT
Personal MTF Long Bias - 30D Momentum / 20D Range

MTF Long Bias is a higher-timeframe context indicator designed for discretionary long-side trading.
The script combines two simple filters:
1. 30D Momentum
Checks whether the confirmed higher-timeframe close is above or below the close from 30 bars ago. This is used as a simple momentum filter, not as a moving average.
2. 20D Range Position
Shows where current price sits inside the recent 20-bar high/low range. The default zones are:
- Bottom zone: lower 35%
- Top zone: upper 20%
- Middle zone: everything between them
The main idea is to separate market context from entry timing:
- 30D momentum defines whether long trades are favored or avoided.
- 20D range position helps identify whether price is near an extreme or in the middle.
- The final Long Bias table summarizes the condition as LONG OK, WAIT, or AVOID.
Default behavior:
- Uses confirmed daily data by default to reduce repainting.
- Shows the 20D range zones on the chart.
- Keeps the 30D momentum base optional through display modes.
- Labels and background colors are off by default to keep the chart clean.
This indicator is not an automated buy/sell system. LONG OK means the higher-timeframe context allows long setups, but actual entries, stops, position sizing, and risk management should be decided separately.
The script combines two simple filters:
1. 30D Momentum
Checks whether the confirmed higher-timeframe close is above or below the close from 30 bars ago. This is used as a simple momentum filter, not as a moving average.
2. 20D Range Position
Shows where current price sits inside the recent 20-bar high/low range. The default zones are:
- Bottom zone: lower 35%
- Top zone: upper 20%
- Middle zone: everything between them
The main idea is to separate market context from entry timing:
- 30D momentum defines whether long trades are favored or avoided.
- 20D range position helps identify whether price is near an extreme or in the middle.
- The final Long Bias table summarizes the condition as LONG OK, WAIT, or AVOID.
Default behavior:
- Uses confirmed daily data by default to reduce repainting.
- Shows the 20D range zones on the chart.
- Keeps the 30D momentum base optional through display modes.
- Labels and background colors are off by default to keep the chart clean.
This indicator is not an automated buy/sell system. LONG OK means the higher-timeframe context allows long setups, but actual entries, stops, position sizing, and risk management should be decided separately.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.