INVITE-ONLY SCRIPT

Pivot automatic

37
Overview
Pivot Automatic is a powerful, overlay-based TradingView indicator that automatically detects Higher Timeframe (HTF) Pivot High (Resistance) and Pivot Low (Support) zones, monitors price interactions with these zones (touches and breakouts), and optionally identifies high-volume trading regions. It features auto-HTF detection, customizable alerts, and visual markers to streamline technical analysis and trade decision-making.

Key Features
Auto Higher Timeframe (HTF) Detection: Automatically selects an appropriate higher timeframe based on your current chart timeframe, eliminating the need for manual HTF input.
Visual Pivot Zones: Clearly displays pivot high (resistance) and pivot low (support) zones as colored, dynamically extending rectangles directly on price action.
Price Touch & Breakout Monitoring: Detects first touches, re-touches, and breakouts of pivot zones, with corresponding visual markers and real-time alerts.
High-Volume Box Detection: Optional visualization of extreme volume bars within user-specified trading sessions, highlighting potential institutional interest areas.
Fully Customizable: Adjust colors, transparency levels, alert triggers, and volume parameters to align with your personal trading style and chart aesthetics.

Parameter Explanation
The indicator’s parameters are organized into three main categories for intuitive configuration.
1. HTF Settings (Higher Timeframe Pivot Zone Configuration)
Pivot High Zone Color: Defaults to gray. This parameter sets the background color of HTF pivot high (resistance) zones, allowing you to match the zone color to your chart theme.
Pivot High Transparency: Defaults to 80, with a range of 0 to 100. It controls the transparency of pivot high zones—0 means fully opaque, while 100 means fully transparent. Higher values help keep the chart uncluttered while maintaining visibility of key resistance levels.
Pivot Low Zone Color: Defaults to fuchsia. This parameter sets the background color of HTF pivot low (support) zones for clear differentiation from resistance zones.
Pivot Low Transparency: Defaults to 80, with a range of 0 to 100. It controls the transparency of pivot low zones, using the same 0-100 scale as pivot high transparency.
2. Touch Alert Settings (Price Interaction Monitoring)
Enable Touch Alert: Defaults to true. This toggle enables or disables all alerts related to price touches and breakouts of pivot zones. Disable it if you only want visual cues without receiving notifications.
Show Touch Markers: Defaults to true. When enabled, it displays small labels on the chart during price interactions with pivot zones—"R" for resistance touches, "R+" for resistance top tests, "S" for support touches, and "S+" for support bottom tests.
Alert on Bottom Touch: Defaults to true. Triggers an alert when price first touches the bottom boundary of a pivot zone, signaling entry into a support or resistance area.
Alert on Top Touch: Defaults to true. Triggers an alert when price reaches the top boundary of a resistance zone or the bottom boundary of a support zone, indicating a test of the zone’s key level.
Minimum Touch Interval (bars): Defaults to 5, with a minimum value of 1. This parameter sets a minimum number of bars between consecutive touch alerts for the same pivot zone, preventing duplicate and redundant alerts.
ATR Length for Label Offset: Defaults to 14. It defines the lookback length of the Average True Range (ATR) indicator used to calculate the distance of touch markers from price action, using the standard ATR length of 14 by default.
Label Offset Multiplier: Defaults to 0.3, with a minimum value of 0.1 and adjustable in 0.1 increments. It multiplies the ATR value to set the offset distance of touch markers from price, preventing overlap between markers and candlesticks.
3. Volume Settings (High-Volume Zone Configuration)
Show Huge Volume Box: Defaults to false. This toggle enables or disables the visualization of bars with extremely high volume, which is disabled by default to reduce chart clutter.
Volume Length: Defaults to 20. It sets the lookback period (number of bars) used to calculate the highest volume and average volume, which are the benchmarks for identifying "huge volume" bars.
Volume Factor: Defaults to 5. It acts as a multiplier for the average volume—only bars with volume greater than the average volume multiplied by this factor are classified as "huge volume" bars. Higher values make the detection more restrictive, capturing only the most extreme volume spikes.
Volume Box Color: Defaults to blue. This parameter sets the background color of the huge volume box for clear visual identification.
Volume Box Transparency: Defaults to 70, with a range of 0 to 100. It controls the transparency of the huge volume box, following the same 0 (fully opaque) to 100 (fully transparent) scale as other zone transparency settings.
Enable Session Filter: Defaults to true. When enabled, it restricts huge volume detection to a user-specified trading session; disabling it allows detection across all time periods.
Trading Session: Defaults to 0930-1600, formatted as HHMM-HHMM. It defines the specific trading session for volume detection—for example, 0930-1600 corresponds to US stock regular trading hours.
Session Timezone: Defaults to UTC-5, with options covering all UTC offsets from UTC-12 to UTC+12. It sets the timezone for the specified trading session, with key mappings including UTC-5 for US Eastern time, UTC+0 for London time, UTC+1 for Paris time, UTC+8 for China/Singapore time, and UTC+9 for Tokyo time.
Hidden Core Logic (Non-Customizable Constants)

Auto HTF Detection Logic
The indicator automatically selects the appropriate higher timeframe based on your current chart timeframe (measured in minutes), following this predefined rule set:
For current timeframes less than 3 minutes (including second-based charts), the auto-selected HTF is 3-minute.
For current timeframes between 3 minutes and 9 minutes, the auto-selected HTF is 15-minute.
For current timeframes between 10 minutes and 29 minutes, the auto-selected HTF is 1-hour (60-minute).
For current timeframes between 30 minutes and 3 hours 59 minutes, the auto-selected HTF is 4-hour (240-minute).
For current timeframes between 4 hours and 23 hours 59 minutes, the auto-selected HTF is Daily (D).
For current timeframes of 1 day or longer, the auto-selected HTF is Weekly (W).

How to Use the Indicator
1. Basic Setup
Add the indicator to your TradingView chart—it will overlay directly on your price action.
Verify the auto-selected HTF, which requires no manual input. If you want to change the underlying HTF logic, simply adjust your current chart timeframe.
Customize the indicator parameters via the "Settings" panel to match your visual preferences and trading needs.
2. Interpreting Visual Cues
Gray Transparent Rectangle: Represents an HTF Pivot High (Resistance Zone). The zone is bounded by the pivot high’s peak at the top and the higher of the pivot bar’s open or close at the bottom.
Fuchsia Transparent Rectangle: Represents an HTF Pivot Low (Support Zone). The zone is bounded by the pivot low’s trough at the bottom and the lower of the pivot bar’s open or close at the top.
Small "R" Label (Red/Orange): Signals a Resistance Zone Touch. A red label indicates the first touch of the zone, while an orange label indicates a re-touch after the minimum touch interval has elapsed.
Small "R+" Label (Solid Red): Signals a Resistance Zone Top Test, meaning price has reached the upper boundary of the pivot high zone and is attempting a breakout.
Small "S" Label (Green/Lime): Signals a Support Zone Touch. A green label indicates the first touch of the zone, while a lime label indicates a re-touch after the minimum touch interval has elapsed.
Small "S+" Label (Solid Green): Signals a Support Zone Bottom Test, meaning price has reached the lower boundary of the pivot low zone and is attempting a breakdown.
Blue Transparent Box (Optional): Represents a Huge Volume Zone, marking a bar with extreme volume that meets the volume factor and session filter criteria.
Extending Rectangle: Identifies an Unbroken Pivot Zone. The rectangle will continue extending to the right as long as price has not broken the zone’s boundary; broken zones stop extending.
3. Alert Triggers
When the Enable Touch Alert parameter is set to true, the indicator generates five distinct types of alerts:
Resistance Touched: Triggers when price first enters the pivot high zone, if the Alert on Bottom Touch parameter is enabled.
Resistance Top Test: Triggers when price reaches the upper boundary of the pivot high zone, if the Alert on Top Touch parameter is enabled.
Resistance Re-touch: Triggers when price re-enters the pivot high zone after the minimum touch interval has passed, if the Alert on Bottom Touch parameter is enabled.
Support Touched/Re-touch: Mirrors the resistance touch alerts, triggering when price enters or re-enters the pivot low zone.
Support/Resistance Broken: Triggers once per breakout when price closes above a pivot high zone or below a pivot low zone on the auto-selected HTF.
4. Trading Strategies with the Indicator
Strategy 1: Pivot Zone Bounce (Range Trading)
Long Setup: Look for price to touch a fuchsia pivot low zone (accompanied by an "S" label), then watch for a bullish reversal candlestick pattern—such as a hammer or bullish engulfing. Confirm the setup with increasing buying volume, then enter a long position.
Short Setup: Look for price to touch a gray pivot high zone (accompanied by an "R" label), then watch for a bearish reversal candlestick pattern—such as a shooting star or bearish engulfing. Confirm the setup with increasing selling volume, then enter a short position.
Stop Loss Placement: For long positions, place the stop loss just below the bottom boundary of the pivot low zone. For short positions, place the stop loss just above the top boundary of the pivot high zone.
Take Profit Target: Target the next nearby pivot zone, or use a risk-reward ratio of at least 1:2 for consistent results.
Strategy 2: Pivot Zone Breakout (Trend Trading)
Long Breakout Setup: Wait for a "Resistance BROKEN" alert, which confirms price has closed above the gray pivot high zone. Enter a long position only if the breakout is accompanied by above-average volume, which validates the strength of the breakout.
Short Breakdown Setup: Wait for a "Support BROKEN" alert, which confirms price has closed below the fuchsia pivot low zone. Enter a short position only if the breakdown is accompanied by above-average volume, which validates the strength of the breakdown.
Stop Loss Placement: For long breakouts, place the stop loss just below the breakout candlestick. For short breakdowns, place the stop loss just above the breakdown candlestick.
Take Profit Target: Target the next major pivot zone in the direction of the trend, or trail your stop loss to capture extended trend moves.
Strategy 3: High-Volume + Pivot Zone Confluence (High-Probability Trading)
Enable the Show Huge Volume Box parameter to display high-volume zones on your chart.
Look for pivot zones that align with these high-volume boxes—this confluence of support/resistance levels and institutional volume activity creates high-probability trade setups.
Prioritize trades where price interacts with these confluent zones, as reactions from these areas are typically stronger and more reliable than reactions from standalone pivot zones.
5. Best Practices
Timeframe Compatibility: The indicator works seamlessly on all timeframes, from second-based charts to weekly charts, thanks to its auto-HTF detection logic.
Asset Compatibility: It is suitable for trading stocks, forex pairs, cryptocurrencies, commodities, and futures contracts across global markets.
Chart Clutter Management: Keep the Show Huge Volume Box parameter disabled by default unless you specifically trade volume-based strategies, to avoid overcrowding your chart with unnecessary elements.
Alert Notification Setup: Configure TradingView’s alert notifications—including email, SMS, and app alerts—to stay updated on price interactions with pivot zones, even when you are not actively monitoring the chart.
Parameter Fine-Tuning: Backtest the indicator with your preferred asset and timeframe to adjust parameters like Volume Factor and Minimum Touch Interval, optimizing the indicator for the specific market conditions you trade.


Disclaimer: This indicator is for educational and analytical purposes only. It does not constitute financial advice. Always conduct your own research and risk assessment before executing any trades in the financial markets.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。