FloorPivotPoints: Floor Pivot Points
תוכן זה אינו זמין עדיין בשפה שלך.
The classic floor-trader pivot with two supports and two resistances, computed from the previous session’s high, low and close and held for the whole session. On a daily chart that is the previous bar; on an hourly chart it is yesterday’s session — daily pivots, which is the definition.
Signature
FloorPivotPoints(lookback, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
lookback |
int Param | Yes | Pinned at 1: the pivot is defined on the immediately preceding period. Bounds 1–1. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads high, low, close. |
Formula
$$ P = \frac{H_p + L_p + C_p}{3} $$ $$ R_1 = 2P - L_p, \quad S_1 = 2P - H_p, \quad R_2 = P + (H_p - L_p), \quad S_2 = P - (H_p - L_p) $$
with subscript p the previous session (its highest high, lowest low and last close).
Warmup
One whole session; all five outputs track the close until then.
Reading the value
fp.pivotfp.r1fp.r2fp.s1fp.s2Multi-value: cannot be chained onto or crossed.
Example
class PivotFade(Strategy): """Buy the first support, exit at the pivot.""" trade = Symbol() sizing = FixedCapital()
def execute(self): fp = FloorPivotPoints(1, on=self.trade) if self.trade.close < fp.s1 and self.trade.is_flat: self.buy(self.trade, reason=f"At S1 {fp.s1:.2f}") if self.trade.close > fp.pivot and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="Pivot reached")Notes
- The traditional pivot set of the exchange trading floors: the pivot is the previous bar’s typical price, and the levels are its reflections off the previous high and low.
- Session-anchored (
session_start): the levels change once per session, at its first bar. A symbol whose session boundary cannot be placed (a weekly or monthly session) cannot be given a previous session, and the indicator says so rather than computing something else. - On a daily chart the numbers are exactly the previous-bar pivots this indicator always gave.