Calculating Price Chart Pivot Points (with Python)

B/O Trading Blog
5 min readJun 21, 2022

Photo generated with Plotly

This post is a tutorial on how to calculate pivot points of price charts using Python. Pivot points can be useful for various reasons, e.g. for

  • Visual chart analysis
  • Optimizing trading strategies
  • Finding optimal trigger points
  • Trend calculations or
  • Finding support and resistance levels.

If you would like to learn how to calculate pivot points on the actual price curve and a smoothed curve using Python, this post is for you.

This story is solely for general information purposes, and should not be relied upon for trading recommendations or financial advice. Source code and information is provided for educational purposes only, and should not be relied upon to make an investment decision. Please review my full cautionary guidance before continuing.

Calculating the Pivot Points

To calculate the pivot points, we are going to use the argrelextrema() function of the scipy stats library.

This function has the following inputs and outputs:

datandarray

Array in which to find the relative extrema.

--

--

B/O Trading Blog

Blogging about algorithmic trading, Python utilities and passive income opportunities.