Home » Technical Analysis Functions » ta.rising in Pine Script

ta.rising in Pine Script

Photo of author
Published on

The ta.rising() function is used to determine whether the values in a given data series are on an upward trend over a specified number of bars. The basic syntax of the function is as follows:

ta.rising(source, length) → series bool


  1. source (series int/float): This argument represents the data series that you want to analyze. Typically, this could be a series of price values, such as closing prices, but it can be any series of integer or floating-point numbers.
  2. length (series int): This is the number of bars over which the function will evaluate the trend. Essentially, this parameter sets the “lookback” period to determine if the current value is higher than any of the previous values for the specified number of bars.


  • The function returns a boolean series (true or false). It yields true if the current value in the source series is greater than any of the previous values within the specified length. Otherwise, it returns false.

Remarks and Considerations

  • Handling na values: It is important to note that na (not available) values in the source series are ignored by ta.rising(). This means the function skips over any na values when assessing the trend.
  • Sensitivity to Length: The length parameter significantly impacts the sensitivity of the ta.rising() function. A shorter length makes the function more responsive to recent changes, while a longer length might better identify longer-term trends.

Practical Application in Trading Strategies

Example: Identifying Bullish Trends

Let’s consider a simple example where we use ta.rising() to identify bullish trends in a stock’s closing price. We will use a length of 10 bars for our analysis.

indicator("Bullish Trend Identifier", overlay=true)

// Define the length for the rising function
lookbackPeriod = 10

// Calculate if the closing price is in a rising trend
isRising = ta.rising(close, lookbackPeriod)

// Plotting
bgcolor(isRising ? color.green : na, transp=90)
rising function in pinescript

In this script, we check if the closing price (close) is in a rising trend over the past 10 bars. If it is, we highlight the background of the chart in green.

Key Features and Takeaways

  • Function Usability: ta.rising() is a versatile function suitable for various strategies, including trend following and breakout systems.
  • Syntax and Application: The function requires two parameters: the source series and the length of the lookback period. This simplicity in syntax makes it easily applicable in diverse scenarios.
  • Customization: Traders can adjust the length parameter to suit their specific strategy needs, whether for short-term scalping or long-term trend identification.
  • Integration with Other Indicators: ta.rising() can be combined with other technical indicators for more robust trading signals. For example, using it in conjunction with moving averages or oscillators can help confirm trends or signal potential reversals.

In conclusion, ta.rising() is a valuable function in Pine Script for identifying upward trends in a given data series. By understanding its syntax, functionality, and practical applications, traders can effectively incorporate this tool into their trading strategies. Remember, the key to successful implementation lies in customizing the length parameter to align with your specific trading goals and combining ta.rising() with other technical analysis tools for comprehensive strategy development.

Leave a Comment