OPEN-SOURCE SCRIPT
Price Simplification [LuxAlgo]

The Price Simplification indicator provides a streamlined representation of price action by reducing complex market movements into essential trend segments using the Ramer-Douglas-Peucker (RDP) algorithm.
🔶 USAGE
The indicator is designed to help traders identify the core structure of price movement by filtering out "noise"—small fluctuations that do not significantly impact the overall trend. By simplifying the price into a series of connected segments, it becomes easier to visualize support/resistance levels, trend slopes, and market geometry.
Users can adjust the level of simplification to suit their needs:
🔹 Extension Line
The script includes an "Extend Last Segment" feature. When enabled, it projects the trajectory of the final simplified segment into the future using a dashed line. This projection begins one bar after the most recent data point, providing a visual guide for the current price momentum without overlapping the historical simplification.
🔶 DETAILS
The core logic of this tool relies on the Ramer-Douglas-Peucker (RDP) algorithm, a classic algorithm used in computer graphics and cartography to reduce the number of points in a curve.
The algorithm works through an iterative process:
To ensure the simplification remains consistent across different assets and timeframes, the script normalizes price coordinates using the Average True Range (ATR). This means the threshold for keeping a point is relative to the current market volatility rather than a fixed price value.
🔶 SETTINGS
This indicator calculates its output based on a fixed window of historical data. Consequently, the line segments are displayed retrospectively and are subject to repainting as new bars develop and the calculation window shifts.
🔶 USAGE
The indicator is designed to help traders identify the core structure of price movement by filtering out "noise"—small fluctuations that do not significantly impact the overall trend. By simplifying the price into a series of connected segments, it becomes easier to visualize support/resistance levels, trend slopes, and market geometry.
Users can adjust the level of simplification to suit their needs:
- A lower ATR Multiplier will result in a line that follows price closely, capturing more minor swings.
- A higher ATR Multiplier will produce a more aggressive simplification, highlighting only the most significant market turns.
🔹 Extension Line
The script includes an "Extend Last Segment" feature. When enabled, it projects the trajectory of the final simplified segment into the future using a dashed line. This projection begins one bar after the most recent data point, providing a visual guide for the current price momentum without overlapping the historical simplification.
🔶 DETAILS
The core logic of this tool relies on the Ramer-Douglas-Peucker (RDP) algorithm, a classic algorithm used in computer graphics and cartography to reduce the number of points in a curve.
The algorithm works through an iterative process:
- It starts with a line segment connecting the first and last points of the lookback window.
- It identifies the point between these two ends that is furthest from the segment (perpendicular distance).
- If this maximum distance is greater than a specified threshold, that point is kept as a "key point," and the algorithm splits the segment into two parts, repeating the process for each.
- If no point is further than the threshold, all intermediate points are discarded, and the segment remains a straight line.
To ensure the simplification remains consistent across different assets and timeframes, the script normalizes price coordinates using the Average True Range (ATR). This means the threshold for keeping a point is relative to the current market volatility rather than a fixed price value.
🔶 SETTINGS
- Window Size: The number of recent bars used to apply the RDP algorithm to.
- ATR Multiplier: The sensitivity of the simplification. Higher values lead to fewer segments and a simpler line.
- ATR Length: The period used to calculate the ATR for price normalization.
- Line Color: The color of the simplified polyline.
- Line Width: The thickness of the polyline and extension.
- Extend Last Segment: When enabled, projects the slope of the final segment forward as a dashed line starting one bar after the last point.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Build your own edge with AI: luxalgo.com
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Build your own edge with AI: luxalgo.com
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。