Table of Contents
Overview
The Pivot Detective is an indicator that simply highlights the waves of the market by identifying the pivot highs and pivot lows by using shapes and zigzag lines.
Check it out on TradingView… 🡵
What makes this indicator unique is that you do not have to specify the number of bars to the left or right side of the pivots (a.k.a. pivot strength), nor do you need to specify percent deviation for filtering the zigzag lines. Thus, the indicator will monitor price action and keep track of pivot high and low prices and implements a common trend analysis algorithm to determine when the trend has reversed to confirm the pivot price and begin tracking the next pivot price. The tolerance of the trend reversal can be configured to be strict or loose depending on your preference.
Indicator Anatomy

Indicator Settings
General Info

Version
The version input is for displaying the published version of the indicator. It is intended to be for informational use only.
Reversal Detection Settings

Trend Reversal Tolerance
Sets the tolerance level in detecting trend reversals from the recently plotted pivot point. The minimum is 1 (least tolerant) and maximum is 4 (most tolerant).
Zigzag Settings

Zigzag Line
When checked, the zigzag lines will be visible.
Line Width
Defines the line width of the zigzag lines. Possible values are:
- 1px – The line will be 1 pixel in width
- 2px – The line will be 2 pixel in width
- 3px – The line will be 3 pixel in width
- 4px – The line will be 4 pixel in width
Confirmed
Defines the confirmed line color and style. A line is confirmed when the price action direction change is confirmed within the internal algorithm. The default color is orange. Possible values for the line style are:
- Solid – The line will be solid with no breaks.
- Dotted – The line will be dotted with small breaks.
- Dashed – The line will be dashed with small breaks.
In-Progress
Defines the in-progress line color and style. A line is in-progress when the price action direction change has not yet been confirmed within the internal algorithm. The default color is light orange. Possible values for the line style are:
- Solid – The line will be solid with no breaks.
- Dotted – The line will be dotted with small breaks.
- Dashed – The line will be dashed with small breaks.
Pivot High Settings

Pivot High Marker
When checked, the pivot high marker (i.e. ▼) will be visible above the bar that was found to be the highest point.
Shape
Defines the pivot marker arrow shape. Possible values are:
- ▲ – Black up pointing triangle
- ▼ – Black down pointing triangle
- △ – White up pointing triangle
- ▽ – White down pointing triangle
- ◭ – Up pointing triangle with left half black
- ⧨ – Down pointing triangle with left half black
- ⮝ – Black upwards equilateral arrowhead
- ⮟ – Black downwards equilateral arrowhead
- ⮙ – Three D right lighted upwards equilateral arrowhead
- ⮛ – Three D left lighted downwards equilateral arrowhead
- 🡅 – Upwards heavy arrow
- 🡇 – Downwards heavy arrow
- 🠝 – Heavy upwards arrow with large equilateral arrowhead
- 🠟 – Heavy downwards arrow with large equilateral arrowhead
- 🖢 – Black up pointing backhand index
- 🖣 – Black down pointing backhand index
Label Content
Adorns the pivot marker with any combination of the price (¤ Price), percent rate of change (Δ(%) RoC), pivot trend relative to previous pivot (HH/LH), or all three options. Possible values are:
- None – No content
- All – All possible content is included, which is price (¤ Price), percent rate of change (Δ(%) RoC), pivot trend relative to previous pivot (HH/LH)
- ¤ Price – Only the price at the pivot high
- Δ(%) Change – Only the percent rate of change
- HH/LH – Only the pivot trend relative to previous pivot
- ¤ + Δ(%) – Only the price at the pivot high AND the percent rate of change
- ¤ + HH/LH – Only the price at the pivot high AND pivot trend relative to previous pivot
- Δ(%) + HH/LH – Only the percent rate of change AND pivot trend relative to previous pivot
Text Size
Changes the text size of all the pivot high markers. Possible values are:
- tiny
- small
- normal
- large
- huge
Confirmed
Defines the confirmed pivot marker color. The default color is green.
In-Progress
Defines the in-progress pivot marker color. The default color is light green.
Pivot Low Settings

Pivot Low Marker
When checked, the pivot low marker (i.e. ▲) will be visible below the bar that was found to be the lowest point.
Shape
Defines the pivot marker arrow shape. Possible values are:
- ▲ – Black up pointing triangle
- ▼ – Black down pointing triangle
- △ – White up pointing triangle
- ▽ – White down pointing triangle
- ◭ – Up pointing triangle with left half black
- ⧨ – Down pointing triangle with left half black
- ⮝ – Black upwards equilateral arrowhead
- ⮟ – Black downwards equilateral arrowhead
- ⮙ – Three D right lighted upwards equilateral arrowhead
- ⮛ – Three D left lighted downwards equilateral arrowhead
- 🡅 – Upwards heavy arrow
- 🡇 – Downwards heavy arrow
- 🠝 – Heavy upwards arrow with large equilateral arrowhead
- 🠟 – Heavy downwards arrow with large equilateral arrowhead
- 🖢 – Black up pointing backhand index
- 🖣 – Black down pointing backhand index
Label Content
Adorns the pivot marker with any combination of the price (¤ Price), percent rate of change (Δ(%) RoC), pivot trend relative to previous pivot (HH/LH), or all three options. Possible values are:
- None – No content
- All – All possible content is included, which is price (¤ Price), percent rate of change (Δ(%) RoC), pivot trend relative to previous pivot (HH/LH)
- ¤ Price – Only the price at the pivot high
- Δ(%) Change – Only the percent rate of change
- HL/LL – Only the pivot trend relative to previous pivot
- ¤ + Δ(%) – Only the price at the pivot high AND the percent rate of change
- ¤ + HL/LL – Only the price at the pivot high AND pivot trend relative to previous pivot
- Δ(%) + HL/LL – Only the percent rate of change AND pivot trend relative to previous pivot
Text Size
Changes the text size of all the pivot high markers. Possible values are:
- tiny
- small
- normal
- large
- huge
Confirmed
Defines the confirmed pivot marker color. The default color is red.
In-Progress
Defines the in-progress pivot marker color. The default color is light red.
Any Alert() Function Call Settings

New Pivot High Point Message
When checked, the given message will be used when the alert is trigger. Supported placeholder are:
- {{exchange}} – The placeholder will be replaced with the syminfo.prefix parameter
- {{ticker}} – The placeholder will be replaced with the syminfo.ticker parameter
- {{currency}} – The placeholder will be replaced with the syminfo.currency parameter
- {{new_pivot_point_price}} – The placeholder will be replaced with the latest confirmed pivot high price
- {{new_pivot_point_roc}} – The placeholder will be replaced with the percent rate of change between the latest confirmed pivot high price and the previous pivot low price
- {{new_pivot_point_diff}} – The placeholder will be replaced with the price difference between the latest confirmed pivot high price and the previous pivot low price
New Pivot Low Point Message
When checked, the given message will be used when the alert is trigger. Supported placeholder are:
- {{exchange}} – The placeholder will be replaced with the syminfo.prefix parameter
- {{ticker}} – The placeholder will be replaced with the syminfo.ticker parameter
- {{currency}} – The placeholder will be replaced with the syminfo.currency parameter
- {{new_pivot_point_price}} – The placeholder will be replaced with the latest confirmed pivot low price
- {{new_pivot_point_roc}} – The placeholder will be replaced with the percent rate of change between the latest confirmed pivot low price and the previous pivot high price
- {{new_pivot_point_diff}} – The placeholder will be replaced with the price difference between the latest confirmed pivot low price and the previous pivot high price
Statistics Settings

Show Statistics Table
When checked, the PIVOT STATISTICS table will be made visible.
Price Change Sections
Shows or hides the sections of the table that contains price changes between rising and falling pivot points.
Bar Count Sections
Shows or hides the sections of the table that contains bar counts between rising and falling pivot points.
Volume Sections
Shows or hides the sections of the table that contains volume at the pivot high and low points.
Table Position
Changes the position of the table on the chart using the combination of values in the two drop-downs that are provided:
- Top, Middle, Bottom
- Left, Center, Right
Text Size
Changes the text size of all the table cells. Possible values are:
- tiny
- small
- normal
- large
- huge
Stat Label Font Weight
Defines the font weight to use for each statistic data point name. Possible values are:
- Bold
- Normal
Color Theme
Changes the colors of the Pivot Statistics table. Possible values are:
- TradingView Dark – Uses the same colors as TradingView’s Dark mode colors
- TradingView Light – Uses the same colors as TradingView’s Light mode colors
- Microsoft Blue Medium – Uses the same colors as Microsft’s Blue Medium Excel table style.
Data Window
The Indicator will output series data values to the chart that are visible in the Data Window of TradingView. This section will describe each data point to help you understand their meaning.
Data Points

Bar Index
Each bar (or candle) on the chart is assigned an index number. This data point will display the current bar index. Numbering is zero-based, where the index of the first bar is 0.
Drop %
The percent rate of change between the latest confirmed pivot low price and the previous pivot high price.
Bounce %
The percent rate of change between the latest confirmed pivot high price and the previous pivot low price.
Pivot Low Price
The price of the latest confirmed pivot low point.
Pivot Low Bar Index
The bar index number of the latest confirmed pivot low point.
Pivot High Price
The price of the latest confirmed pivot high point.
Pivot High Bar Index
The bar index number of the latest confirmed pivot high point.
New Pivot Point Price
The price of the latest confirmed pivot point (both low or high).
New Pivot Point RoC
The percent rate of change of the latest confirmed pivot point with the previous pivot point (both low or high).
New Pivot Point Diff
The price difference of the latest confirmed pivot point with the previous pivot point (both low or high).
Trend Direction
The current trend direction of the price action. Possible values are:
- 1 – (Positive one) Rising
- -1 – (Negative one) Falling
Pivot Statistics Table
This section will describe each section of the data points.

Falling Price Changes
This section presents statistical data points regarding the falling price changes. These values will only update as soon as a pivot low is confirmed.
Count / Min / Max
Displays the count, minimum, and maximum percent rate of changes between the pivot high and low points.
Mean / Median / Mode
Displays the mean (average), median (middle value), mode (most frequent value) of all the percent rate of changes between the pivot high and low points.
Std. Dev.
Displays the standard deviation of all the percent rate of changes between the pivot high and low points.
Skewness / Kurtosis
Displays the skewness and kurtosis values that measure the asymmetry and arching measures of the falling price change data points.
Rising Price Changes
This section presents statistical data points regarding the rising price changes. These values will only update as soon as a pivot high is confirmed.
Count / Min / Max
Displays the count, minimum, and maximum percent rate of changes between the pivot low and high points.
Mean / Median / Mode
Displays the mean (average), median (middle value), mode (most frequent value) of all the percent rate of changes between the pivot low and high points.
Std. Dev.
Displays the standard deviation of all the percent rate of changes between the pivot high and low points.
Skewness / Kurtosis
Displays the skewness and kurtosis values that measure the asymmetry and arching measures of the falling price change data points.
Falling Bar Counts
This section presents statistical data points regarding the falling bar counts. These values will only update as soon as a pivot low is confirmed.
Count / Min / Max
Displays the count, minimum, and maximum bar counts between the pivot high and low points.
Mean / Median / Mode
Displays the mean (average), median (middle value), mode (most frequent value) of all the bar counts between the pivot high and low points.
Std. Dev.
Displays the standard deviation of all the bar counts between the pivot high and low points.
Skewness / Kurtosis
Displays the skewness and kurtosis values that measure the asymmetry and arching measures of the falling bar count data points.
Rising Bar Counts
This section presents statistical data points regarding the rising bar counts. These values will only update as soon as a pivot high is confirmed.
Count / Min / Max
Displays the count, minimum, and maximum bar counts between the pivot low and high points.
Mean / Median / Mode
Displays the mean (average), median (middle value), mode (most frequent value) of all the bar counts between the pivot low and high points.
Std. Dev.
Displays the standard deviation of all the bar counts between the pivot low and high points.
Skewness / Kurtosis
Displays the skewness and kurtosis values that measure the asymmetry and arching measures of the rising bar count data points.
Volume at Pivot Lows
This section presents statistical data points regarding the volume at the confirmed pivot low points. These values will only update as soon as a pivot low is confirmed.
Count / Min / Max
Displays the count, minimum, and maximum volume at all the confirmed pivot low points.
Mean / Median / Mode
Displays the mean (average), median (middle value), mode (most frequent value) of all the volume at all the confirmed pivot low points.
Std. Dev.
Displays the standard deviation of all the volume at all the confirmed pivot low points.
Skewness / Kurtosis
Displays the skewness and kurtosis values that measure the asymmetry and arching measures of the volume at all the confirmed pivot low points.
Volume at Pivot Highs
This section presents statistical data points regarding the volume at the confirmed pivot high points. These values will only update as soon as a pivot high is confirmed.
Count / Min / Max
Displays the count, minimum, and maximum volume at all the confirmed pivot high points.
Mean / Median / Mode
Displays the mean (average), median (middle value), mode (most frequent value) of all the volume at all the confirmed pivot high points.
Std. Dev.
Displays the standard deviation of all the volume at all the confirmed pivot high points.
Skewness / Kurtosis
Displays the skewness and kurtosis values that measure the asymmetry and arching measures of the volume at all the confirmed pivot high points.