Pivot Point Strategies

Pivot Point strategies are a widely used approach in algorithmic trading to identify potential support and resistance levels in the market. These strategies revolve around the calculation and use of Pivot Points, which are derived from the previous trading day’s high, low, and closing prices. Pivot Points provide traders with potential entry and exit points for their trades and are especially popular among day traders and scalpers. Below is an in-depth exploration of Pivot Point strategies, their calculation, implementation, and application in algorithmic trading.

Calculation of Pivot Points

Let H, L, C and O be the previous candle’s high, low, close and open. The levels apply to the next candle. Switch between daily and weekly candles to change the period used by the calculation.

The central pivot is the average of the high, low and close. The first three support and resistance pairs follow from the central pivot and the range D=H-L.

P=\frac{H+L+C}{3}
\begin{aligned} R_1 &= 2P-L & S_1 &= 2P-H \\ R_2 &= P+D & S_2 &= P-D \\ R_3 &= H+2(P-L) & S_3 &= L-2(H-P) \end{aligned}
BTC/USD Daily candles Kraken
StockSharp JS-Charts

Loading candle history…

Types of Pivot Points

Traditional Pivot Points

The first chart plots the traditional levels.

Fibonacci Pivot Points

Use the same central pivot and multiply the previous range D by the Fibonacci ratios shown below.

\begin{gathered} P=\frac{H+L+C}{3},\qquad (a_1,a_2,a_3)=(0.382,\,0.618,\,1) \\ R_i=P+a_iD,\qquad S_i=P-a_iD \end{gathered}
BTC/USD Daily candles Kraken
StockSharp JS-Charts

Loading candle history…

Woodie’s Pivot Points

Woodie gives twice the weight to the current candle’s open O_t. The support and resistance levels still use the previous candle’s high and low.

\begin{gathered} P=\frac{H+L+2O_t}{4} \\ \begin{aligned} R_1 &= 2P-L & S_1 &= 2P-H \\ R_2 &= P+D & S_2 &= P-D \end{aligned} \end{gathered}
BTC/USD Daily candles Kraken
StockSharp JS-Charts

Loading candle history…

Camarilla Pivot Points

The four pairs of Camarilla levels extend from the previous close C. The denominators d_i determine the distance of each pair from that close.

\begin{gathered} (d_1,d_2,d_3,d_4)=(12,\,6,\,4,\,2) \\ R_i=C+\frac{1.1D}{d_i},\qquad S_i=C-\frac{1.1D}{d_i} \end{gathered}
BTC/USD Daily candles Kraken
StockSharp JS-Charts

Loading candle history…

DeMark’s Pivot Points

DeMark changes the pivot weights based on the previous candle’s direction, determined by comparing its close with its open.

X=\begin{cases} H+2L+C & C<O \\ 2H+L+C & C>O \\ H+L+2C & C=O \end{cases}, \qquad P=\frac{X}{4},\quad R_1=\frac{X}{2}-L,\quad S_1=\frac{X}{2}-H
BTC/USD Daily candles Kraken
StockSharp JS-Charts

Loading candle history…

TradingView pivot formulas

Implementing Pivot Point Strategies in Algorithmic Trading

Reversal Trading Strategy

One of the most common strategies using Pivot Points is the Reversal Trading Strategy. This strategy involves taking buy or sell positions when the price reverses at key Pivot Point levels.

Breakout Trading Strategy

In a Breakout Trading Strategy, traders look for prices to break through key Pivot Point levels with substantial volume, indicating the potential for a continued move in the breakout direction.

Range-Bound Trading Strategy

For markets that tend to trade within tight ranges, the Range-Bound Trading Strategy involves buying at support levels and selling at resistance levels.

Combining Pivot Points with Other Indicators

Combining Pivot Points with other technical indicators can enhance the effectiveness of trading strategies. Commonly combined indicators include:

Example of an Algorithm Using Pivot Points

Below is a basic example of a Python algorithm using Pivot Points and the pandas and numpy libraries:

import pandas as pd

def calculate_pivots(data):
    high = data["High"].shift()
    low = data["Low"].shift()
    close = data["Close"].shift()
    pivot = (high + low + close) / 3
    spread = high - low
    return data.assign(
        P=pivot,
        R1=2 * pivot - low,
        S1=2 * pivot - high,
        R2=pivot + spread,
        S2=pivot - spread,
        R3=high + 2 * (pivot - low),
        S3=low - 2 * (high - pivot),
    )

data = pd.DataFrame({
    "High": [150, 155, 160, 165, 170],
    "Low": [140, 142, 145, 148, 150],
    "Close": [147, 150, 155, 160, 165],
})
levels = calculate_pivots(data)
levels["Signal"] = "Hold"
levels.loc[levels["Close"] > levels["R1"], "Signal"] = "Buy"
levels.loc[levels["Close"] < levels["S1"], "Signal"] = "Sell"
print(levels[["P", "R1", "S1", "Signal"]])

Many trading platforms and tools provide built-in capabilities to calculate and use Pivot Points in trading strategies. Some of these platforms include:

Conclusion

Pivot Point strategies are an essential part of the toolkit for both manual and algorithmic traders. These strategies leverage historical price data to identify key levels where the market sentiment may shift. Implementing Pivot Point strategies in algorithmic trading involves calculating Pivot Points, determining support and resistance levels, and developing algorithms that generate trading signals based on these levels. When combined with other technical indicators and tools, Pivot Point strategies can become a powerful component of a trader’s overall strategy. The adoption of platforms like MetaTrader, NinjaTrader, TradingView, StockSharp, and Interactive Brokers can facilitate the development and execution of Pivot Point-based algorithms.