Home » Technical Analysis Functions » Understanding the ta.pivotlow() Function in Pine Script

Understanding the ta.pivotlow() Function in Pine Script

Photo of author
Published on

ta.pivotlow(), which is pivotal in identifying low points in price data. This article will provide an in-depth understanding of the ta.pivotlow() function, its syntax, application, and significance in trading strategies.

Introduction to ta.pivotlow()

The ta.pivotlow() function is designed to detect pivot lows in a price series. A pivot low is a point where the price is lower than a certain number of bars before and after it. This function is crucial for traders who focus on trend reversals and support levels.

Syntax & Overloads

The function has two primary syntax forms:

  1. Basic Form: ta.pivotlow(leftbars, rightbars) → series float
  2. Extended Form: ta.pivotlow(source, leftbars, rightbars) → series float


  • leftbars (series int/float): Defines the number of bars to the left of the pivot low that should be higher than the pivot low.
  • rightbars (series int/float): Specifies the number of bars to the right of the pivot low that should be higher than the pivot low.
  • source (optional): The price data series, like close, open, etc. If not specified, close is used by default.

Example Implementation

Below is an example script that demonstrates how to use ta.pivotlow():

indicator("PivotLowFinder", overlay=true)
numLeftBars = input(2)
numRightBars = input(2)
pivotLowPoint = ta.pivotlow(low ,numLeftBars, numRightBars)
plot(pivotLowPoint, style=plot.style_cross, linewidth=3, color=color.blue, offset=-numRightBars)
pivotlow function pinescript

This script creates an indicator that plots pivot low points on the chart with blue crosses. The number of left and right bars are adjustable through input.

Understanding the Example

  1. Indicator Declaration: indicator("PivotLowFinder", overlay=true) sets up the script as an overlay on the price chart.
  2. User Inputs: numLeftBars and numRightBars allow users to set the strength of the pivot low.
  3. Pivot Low Calculation: pivotLowPoint = ta.pivotlow(close, numLeftBars, numRightBars) calculates the pivot low point based on the user-defined strengths.
  4. Plotting: The plot() function visualizes the pivot low points.


The function returns the price of the pivot low point or ‘NaN’ if a pivot low is not found.


When using series types for leftbars or rightbars, it’s essential to use the max_bars_back function for the source variable to ensure proper calculation.

Key Features and Takeaways

  • Function Utility: ta.pivotlow() is valuable for identifying potential support levels and trend reversals.
  • Syntax Flexibility: It offers both a basic and an extended form, accommodating various trading strategies.
  • Customization: The function allows customization through user inputs, enhancing its adaptability to different market conditions.
  • Visualization: It enables traders to visualize pivot low points directly on the price chart, aiding in quicker decision-making.
  • Precision in Trend Analysis: By adjusting leftbars and rightbars, traders can fine-tune the precision of their trend reversal analysis.

In conclusion, the ta.pivotlow() function in Pine Script is an essential tool for technical analysis, especially for strategies revolving around support levels and trend reversals. Its flexibility and adaptability make it a valuable addition to any trader’s toolkit.

Leave a Comment