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

Basic Pivot Point (P)

The central Pivot Point (P) is calculated using the following formula:

[ P = \frac{(High_{previous} + Low_{previous} + Close_{previous})}{3} ]

Where:

Support and Resistance Levels

Once the central Pivot Point (P) is determined, additional support and resistance levels can be calculated as follows:

First Level of Resistance (R1) and Support (S1)

[ R1 = (2 \times P) - Low_{previous} ] [ S1 = (2 \times P) - High_{previous} ]

Second Level of Resistance (R2) and Support (S2)

[ R2 = P + (High_{previous} - Low_{previous}) ] [ S2 = P - (High_{previous} - Low_{previous}) ]

Third Level of Resistance (R3) and Support (S3)

[ R3 = High_{previous} + 2 \times (P - Low_{previous}) ] [ S3 = Low_{previous} - 2 \times (High_{previous} - P) ]

Types of Pivot Points

Standard Pivot Points

Standard Pivot Points, as described above, use the previous trading day’s high, low, and close values. They are the most commonly used type of Pivot Points.

Fibonacci Pivot Points

Fibonacci Pivot Points incorporate Fibonacci retracement and extension levels into the calculation of support and resistance levels:

Pivot Point (P)

[ P = \frac{(High_{previous} + Low_{previous} + Close_{previous})}{3} ]

Support and Resistance Levels

[ R1 = P + 0.382 \times (High_{previous} - Low_{previous}) ] [ R2 = P + 0.618 \times (High_{previous} - Low_{previous}) ] [ R3 = P + (High_{previous} - Low_{previous}) ]

[ S1 = P - 0.382 \times (High_{previous} - Low_{previous}) ] [ S2 = P - 0.618 \times (High_{previous} - Low_{previous}) ] [ S3 = P - (High_{previous} - Low_{previous}) ]

Woodie’s Pivot Points

Woodie’s Pivot Points give more weight to the closing price of the previous trading period:

Pivot Point (P)

[ P = \frac{(High_{current} + Low_{current} + 2 \times Close_{previous})}{4} ]

Support and Resistance Levels

[ R1 = 2 \times P - Low_{current} ] [ S1 = 2 \times P - High_{current} ] [ R2 = P + (High_{current} - Low_{current}) ] [ S2 = P - (High_{current} - Low_{current}) ]

Camarilla Pivot Points

Camarilla Pivot Points were developed by Nick Stott in the late 1980s and use closing prices and a series of multipliers to calculate support and resistance levels:

[ R1 = Close_{previous} + (High_{previous} - Low_{previous}) \times 1.1 \times \frac{1}{20} ] [ R2 = Close_{previous} + (High_{previous} - Low_{previous}) \times 1.1 \times \frac{2}{20} ] [ R3 = Close_{previous} + (High_{previous} - Low_{previous}) \times 1.1 \times \frac{3}{20} ] [ R4 = Close_{previous} + (High_{previous} - Low_{previous}) \times 1.1 \times \frac{4}{20} ]

[ S1 = Close_{previous} - (High_{previous} - Low_{previous}) \times 1.1 \times \frac{1}{20} ] [ S2 = Close_{previous} - (High_{previous} - Low_{previous}) \times 1.1 \times \frac{2}{20} ] [ S3 = Close_{previous} - (High_{previous} - Low_{previous}) \times 1.1 \times \frac{3}{20} ] [ S4 = Close_{previous} - (High_{previous} - Low_{previous}) \times 1.1 \times \frac{4}{20} ]

DeMark’s Pivot Points

DeMark’s Pivot Points, named after Tom DeMark, use a different approach to calculate the central Pivot Points:

X Value Definition Based on Close

[ X = \begin{cases} High_{previous} + Low_{previous} + 2 \times Close_{previous}, & \text{if Close_{previous} < Open_{previous}}
High_{previous} + 2 \times Low_{previous} + Close_{previous}, & \text{if Close_{previous} > Open_{previous}}
2 \times (High_{previous} + Low_{previous}), & \text{if Close_{previous} = Open_{previous}} \end{cases} ]

Central Pivot Point (P)

[ P = X / 4 ]

Support and Resistance Levels

[ R1 = X / 2 - Low_{previous} ] [ S1 = X / 2 - High_{previous} ]

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](../i/import.html) pandas as pd
[import](../i/import.html) numpy as np

def calculate_pivot_points(df):
    df['P'] = (df['High'] + df['Low'] + df['Close']) / 3
    df['R1'] = (2 * df['P']) - df['Low']
    df['S1'] = (2 * df['P']) - df['High']
    df['R2'] = df['P'] + (df['High'] - df['Low'])
    df['S2'] = df['P'] - (df['High'] - df['Low'])
    df['R3'] = df['High'] + 2 * (df['P'] - df['Low'])
    df['S3'] = df['Low'] - 2 * (df['High'] - df['P'])
    [return](../r/return.html) df

def trading_signal(df):
    conditions = [
        (df['Close'] < df['S1']),
        (df['Close'] > df['R1'])
    ]
    choices = ['Sell', 'Buy']
    df['Signal'] = np.select(conditions, choices, [default](../d/default.html)='[Hold](../h/hold.html)')
    [return](../r/return.html) df

# Sample DataFrame
data = {
    'Date': pd.date_range(start='2023-01-01', periods=5, freq='D'),
    'High': [150, 155, 160, 165, 170],
    'Low': [140, 142, 145, 148, 150],
    'Close': [147, 150, 155, 160, 165]
}
df = pd.DataFrame(data)
df = calculate_pivot_points(df)
df = trading_signal(df)

print(df)

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, QuantConnect, and Interactive Brokers can facilitate the development and execution of Pivot Point-based algorithms.