PROTECTED SOURCE SCRIPT

Auto Trendlines (Finviz Style)

213
Oculus Auto Trendlines
Version 1.0 | Pine Script v6

Overview
Oculus Auto Trendlines automatically identifies and plots the most significant support and resistance trendlines by connecting the two most recent swing highs (resistance) and swing lows (support) over a user-defined pivot lookback. Each line extends dynamically to the right, recalculates in real time, and self-invalidates when price decisively breaks beyond it by a configurable tolerance.

Key Features

Automatic Pivot Detection
Uses ta.pivothigh and ta.pivotlow over your chosen bar span to pinpoint significant market turning points.

Dynamic Trendline Drawing
Connects the last two valid pivots to form support and resistance lines that update and extend to the right each bar.

Break-Triggered Refresh
When price closes beyond a drawn trendline by more than the break tolerance, that line is removed and a new one is drawn from the next valid pivots.

Configurable Sensitivity

Pivot Lookback: Number of bars on each side to define swings.

Break Tolerance: Percentage buffer to prevent false invalidations on minor wicks.

Clean Overlay
Minimal code and plotting ensures your chart remains uncluttered—only one support and one resistance line are visible at any time.

How to Use

Add to Chart: Apply “Oculus Auto Trendlines” to any symbol and timeframe.

Set Inputs:

Pivot Lookback: Larger values produce smoother, longer-term lines; smaller values react faster to recent price.

Break Tolerance (%): Adjust to allow for minor wicks or noise without resetting lines.

Read Trendlines:

The red resistance line connects the two most recent swing highs.

The green support line connects the two most recent swing lows.

Lines automatically redraw when invalidated by a clean break beyond tolerance.

Combine with Other Analysis: Use these auto-drawn trendlines alongside indicators like moving averages, volume, or price patterns for stronger confluence.

Inputs

Pivot Lookback: 10 (bars each side)

Break Tolerance (%): 0.2%

Version History

1.0 – Initial release with real-time pivot detection, auto-updating trendlines, and break validation.

Disclaimer
This indicator is provided for educational purposes. Always backtest settings on historical data, verify trendline relevance, and apply proper risk management before trading live.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。