OPEN-SOURCE SCRIPT
已更新 Simple Auto Trend Lines

Opinionated way of drawing automatic trend lines. It draws automatically trend lines based on specified top/bottom strengths with multiple sets in order to keep track of multiple levels of interest.
Has the ability to hide invalidated trendlines if price moves away from it.
Has the ability to hide invalidated trendlines if price moves away from it.
版本注释
Opinionated way of drawing automatic trend lines. It draws automatically trend lines based on specified top/bottom strengths with multiple sets in order to keep track of multiple levels of interest.Has the ability to hide invalidated trendlines if price moves away from it.
版本注释
Fix: The requested historical offset (X) is beyond the historical buffer’s limit (Y)版本注释
Fix: filter out some of the invalid trendlines where there are bars below green one and bars above red one between second pivot and current price - these are not good enough 版本注释
Add: line thickness setting版本注释
Major Rework of the indicator. My motivation was to reduce the amount of fiddling required in order to automatically draw quality trendlines. As usual, it's my subjective opinion on how they should be drawn, but I hope you'll appreciate the end result.
Now you don't need to specify 5 sets of values. A single set of values (for each pivot highs and lows) should work just fine and highlight significant trendlines.
Added settings:
1. Candles to Cross for Invalidation - the number of candles to cross above/below for the trendline to disappear (Recommended: 2-3)
2. Max drawing distance (bars) - how many bars in the past the indicator will go to draw the lines. Higher value can result in indicator timeout due to tradingview computational limitations (Recommended: 500)
3. Max Lines Per Pivot - how many trendlines a single starting pivot can be made (Recommended: 1)
4. Max Resistance Trendlines - number of total resistance lines to reduce clutter (Recommended: 1)
5. Max Support Trendlines - number of total support lines to reduce clutter (Recommended: 1)
Added Alerts:
1. Resistance Trendline Crossed
2. Resistance Trendline Crossed & Closed Above
3. Support Trendline Crossed
4. Support Trendline Crossed & Closed Below
Note: alerts might not work as expected and need some testing. Will test it during the week and update the indicator if alerts don't work properly.
Note: lower pivot high/low values can result in indicator timing out due to tradingview computation limitations. Updating some settings should refresh the indicator to get going again. Increase the high/low values to reduce the likelihood of timeouts, but generally speaking it should perform well (based on my testing with high/low: 4 & 1000 bars max lookback).
Enjoy!
版本注释
fixed: lines were disappearing when new candle printed. this should no longer happen版本注释
Simple Auto Trend Lines automatically identifies and draws key trendlines on your chart by detecting significant pivot points in price action. Unlike manual trendline drawing that relies on subjective judgment, this indicator uses algorithmic pivot detection to create objective resistance and support trendlines.The indicator works by identifying pivot highs and lows using customizable lookback parameters, then connecting these pivots to form valid trendlines. A trendline is considered valid when no price action penetrates it between the connected pivot points. The script intelligently filters out invalid lines and prioritizes the most significant trendlines based on your settings.
Key features include:
- Automatic detection of resistance (red) and support (green) trendlines
- Customizable pivot detection sensitivity with separate settings for highs and lows
- Intelligent line validation that ensures trendlines aren't penetrated between pivot points
- Line break detection with alerts when price crosses or closes beyond a trendline
- Visual highlighting of pivot points with customizable colors and sizes
- Configurable maximum number of trendlines to prevent chart clutter
The indicator is particularly effective for identifying key price levels, trend channels, and potential reversal zones. Use it to objectively identify support/resistance areas, confirm trend direction, spot potential breakouts/breakdowns, and receive alerts when significant trendlines are breached.
Customize the settings to match your trading timeframe - tighter pivot settings for short-term trading and wider settings for longer-term analysis. The trendline break alerts can be especially valuable for timing entries and exits based on objective technical levels rather than subjective analysis.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。