Home » Technical Analysis Functions » The ta.min Function in Pine Script

The ta.min Function in Pine Script

Photo of author
Published on

Pine Script, the scripting language behind TradingView charts, offers the ta.min function to extract this value seamlessly. Let’s dissect this function and see it in action.

Understanding ta.min

What does ta.min do?

The primary objective of the ta.min function is to return the all-time lowest value of a given source since the beginning of the chart, right up to the current bar. This ensures that you’re always aware of the absolute lowest value a particular data point (like price) has ever reached.

Function Syntax

Using ta.min in Pine Script is a straightforward affair:

ta.min(source) → series float


  • source (series int/float): This is the data series for which the all-time low is to be determined. Commonly, it could be closing prices, volume, or other technical indicators.

Basic Example

indicator("All-time low using ta.min")
allTimeLow = ta.min(close)
plot(allTimeLow, title="All-time Low", color=color.blue)

In the above script, ta.min computes the all-time lowest closing price and then plots it on the chart. This line will typically remain static or move down but never up, as it represents the lowest value ever reached.

Unique Use Case: Dynamic Support Levels

n this example, we’ll visually identify periods where the price is coming close to its all-time low, which might be of interest for those considering long positions or wanting to keep an eye on potential support zones.

indicator("Highlighting Near All-Time Lows using ta.min", overlay=true)

allTimeLow = ta.min(close)
proximityPercentage = 0.05  // 5% proximity to the all-time low
thresholdValue = allTimeLow * (1 + proximityPercentage)

// Check if current close is within the 5% range of the all-time low
withinProximity = close <= thresholdValue

// Highlight bars that are within the specified proximity
bgcolor(withinProximity ? color.new(color.red, 90) : na, title="Near All-time Low Zone")
The ta.min Function in Pine Script


  1. We determine the all-time low of the closing prices using ta.min.
  2. A threshold value is then calculated, which is 5% above the all-time low. This serves as our upper limit for highlighting bars.
  3. The bgcolor function is used to color the background of bars where the closing price is below this threshold, indicating periods where the price is close to its all-time low.

Key Takeaway:
The ta.min function in Pine Script is an instrumental tool for traders wanting to identify all-time lows in a data series. When used creatively, it can serve as a foundation for more complex strategies and studies, such as determining dynamic support zones based on historical data.


Knowing the all-time low of any data series is more than just a fun fact. It’s an integral piece of information for traders and analysts alike. With Pine Script’s ta.min function, fetching this data becomes effortless, making it an indispensable function for anyone looking to craft intricate or data-specific trading strategies on TradingView. Armed with this knowledge, you’re now ready to leverage this function to its fullest potential in your scripts.

Leave a Comment