OPEN-SOURCE SCRIPT
ที่อัปเดต: X-trender

This script is designed to identify the market trend, its momentum, and potential reversal points by combining Arnaud Legoux Moving Averages (ALMA) and the Relative Strength Index (RSI).
The indicator is plotted in a separate pane below the price chart (overlay=false).
Here is a detailed breakdown of how the script works:
1. Core Logic (The Calculation)
The indicator filters out market noise by combining two powerful tools:
- ALMA (Arnaud Legoux Moving Average): An advanced moving average that reduces lag while maintaining superior smoothness. The script allows you to choose your preferred price source (e.g., Close, HLC3, OHLC4).
- RSI (Relative Strength Index): Instead of applying RSI directly to raw prices, the script calculates the RSI of the smoothed ALMA values and subtracts 50. This centers the indicator around a zero (0) baseline:
x - Values above 0 signal a bullish (upward) trend.
x - Values below 0 signal a bearish (downward) trend.
2. Dual Time Horizons (Short vs. Long)
The indicator analyzes the market from two perspectives simultaneously, creating two overlapping histograms:
- ShortTermXtrender: Calculates the RSI based on the difference between two fast ALMA lines. This captures rapid, local changes in price momentum.
- LongTermXtrender: Calculates the RSI directly from a single long ALMA line. This tracks the more stable, macro market trend.
3. Visual Signals and Charting
- Histogram Colors: Bright green/dark green represents upward momentum, while bright red/dark red represents downward momentum. The color brightens when the move accelerates and darkens when it slows down.
- Signal Line: A further smoothed ALMA of the short-term indicator. It turns bright green when moving up and red when moving down.
- Reversal Dots (Tiny Circles): Plotted at the exact pivot points of the signal line. A green dot marks a local bottom (potential buy signal), and a red dot marks a local peak (potential sell signal).
- Fixed Levels: Horizontal lines at 30 / -30 and 40 / -40 help identify overbought and oversold conditions.
4. Dynamic ATR Bands
When enabled, orange bands are drawn around the short-term indicator based on market volatility (Average True Range). These work similarly to Bollinger Bands. When the histogram breaks outside these bands, it signals an extreme market condition and a high probability of a price correction.
5. Multi-Timeframe (MTF) Dashboard
The script features an MTF dashboard that creates a clean table in the corner of your chart. It fetches the long-term trend data from multiple higher timeframes (e.g., 15m, 1h, 4h, 1D) at the same time:
- Displays BULL (green) if the long-term trend on that timeframe is positive.
- Displays BEAR (red) if the trend on that timeframe is negative.This allows you to quickly check the "higher timeframe bias" without switching charts.
The indicator is plotted in a separate pane below the price chart (overlay=false).
Here is a detailed breakdown of how the script works:
1. Core Logic (The Calculation)
The indicator filters out market noise by combining two powerful tools:
- ALMA (Arnaud Legoux Moving Average): An advanced moving average that reduces lag while maintaining superior smoothness. The script allows you to choose your preferred price source (e.g., Close, HLC3, OHLC4).
- RSI (Relative Strength Index): Instead of applying RSI directly to raw prices, the script calculates the RSI of the smoothed ALMA values and subtracts 50. This centers the indicator around a zero (0) baseline:
x - Values above 0 signal a bullish (upward) trend.
x - Values below 0 signal a bearish (downward) trend.
2. Dual Time Horizons (Short vs. Long)
The indicator analyzes the market from two perspectives simultaneously, creating two overlapping histograms:
- ShortTermXtrender: Calculates the RSI based on the difference between two fast ALMA lines. This captures rapid, local changes in price momentum.
- LongTermXtrender: Calculates the RSI directly from a single long ALMA line. This tracks the more stable, macro market trend.
3. Visual Signals and Charting
- Histogram Colors: Bright green/dark green represents upward momentum, while bright red/dark red represents downward momentum. The color brightens when the move accelerates and darkens when it slows down.
- Signal Line: A further smoothed ALMA of the short-term indicator. It turns bright green when moving up and red when moving down.
- Reversal Dots (Tiny Circles): Plotted at the exact pivot points of the signal line. A green dot marks a local bottom (potential buy signal), and a red dot marks a local peak (potential sell signal).
- Fixed Levels: Horizontal lines at 30 / -30 and 40 / -40 help identify overbought and oversold conditions.
4. Dynamic ATR Bands
When enabled, orange bands are drawn around the short-term indicator based on market volatility (Average True Range). These work similarly to Bollinger Bands. When the histogram breaks outside these bands, it signals an extreme market condition and a high probability of a price correction.
5. Multi-Timeframe (MTF) Dashboard
The script features an MTF dashboard that creates a clean table in the corner of your chart. It fetches the long-term trend data from multiple higher timeframes (e.g., 15m, 1h, 4h, 1D) at the same time:
- Displays BULL (green) if the long-term trend on that timeframe is positive.
- Displays BEAR (red) if the trend on that timeframe is negative.This allows you to quickly check the "higher timeframe bias" without switching charts.
Release Note
minor code chcangesRelease Note
.Release Note
- Changed the RSI calculation method: replaced the built-in `ta.rsi` to (RMA) with a manually calculated `ta.rsi` to (ALMA) to ensure the script's overall operational consistency.This allows the calculations and the shape of the curve to more accurately and promptly identify the start and end of ongoing momentum and trends.
- Several minor cosmetic changes and code fixes.
Release Note
- a slight name changeRelease Note
-old script ;(สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน