Skip to content

Confirmed period pivots (ta.pivot_points)

View Markdown

Compute support and resistance from the previous complete period marked by explicit anchor values; Woodie additionally uses the new period's open. developing=True outputs cumulative levels for the current anchored interval; the first anchor bar is immediately available, invalid OHLC contaminates values until the next anchor, and Woodie forbids developing.

Indicator catalog · How to use indicators

Run this example

This complete script uses bundled data. It observes the selected output without placing trades.

import numpy as np
from openbacktesting import Backtest, Strategy
from openbacktesting.test import GOOG

data = GOOG.copy()
data["anchor"] = (np.arange(len(data)) % 20 == 0).astype(float)

class Example(Strategy):
    def init(self):
        self.value = self.ta.pivot_points(inputs={'open_': 'Open', 'high': 'High', 'low': 'Low', 'close': 'Close', 'anchor': 'anchor'})
        self.latest_value = None

    def next(self):
        channel = self.value.p
        if channel.valid[-1]:
            self.latest_value = float(channel[-1])

result = Backtest(data, Example).run()
print(result["_strategy"].latest_value)

Example inputs: anchor marks every twentieth bar; replace it with actual period starts.

Call and parameters

self.ta.pivot_points(
    *,
    method='traditional',
    developing=False,
    inputs=None,
    backend=None,
    required_outputs=None,
)

Register in init(). Read the returned channel in next() after checking valid[-1].

Parameter Meaning Type Default Allowed values
method Pivot-point formula family; choose one of the listed methods. str traditional Allowed values: ['traditional', 'fibonacci', 'woodie', 'classic', 'demark', 'camarilla']
developing Use the current anchored interval instead of the previous complete interval. bool False No additional constraints

source/named source arguments accept a column name or same-run single-channel handle. Alternatively, inputs maps each input below to a column or handle. backend selects a supported implementation; required_outputs selects channels for readiness diagnostics. See shared arguments and handles.

Inputs and outputs

Required inputs: open_, high, low, close, anchor.

Channel Meaning
p Central pivot level
r1 Resistance level 1
s1 Support level 1
r2 Resistance level 2
s2 Support level 2
r3 Resistance level 3
s3 Support level 3
r4 Resistance level 4
s4 Support level 4
r5 Resistance level 5
s5 Support level 5

Reading values safely

Insufficient history or missing inputs can make a channel invalid. Check that channel's valid mask; ready is diagnostic and never suppresses next(). Multi-output results may have different valid channels on the same bar.

Supply a complete 0/1 anchor series. The example resets every 20 bars only to demonstrate binding; replace it with your intended periods. Exchange sessions are not inferred.

Indicator catalog · Custom calculations