PINE LIBRARY
reversal

Library "reversals"
psar(af_start, af_increment, af_max)
Calculates Parabolic Stop And Reverse (SAR)
Parameters:
af_start (simple float): Initial acceleration factor (Wilder's original: 0.02)
af_increment (simple float): Acceleration factor increment per new extreme (Wilder's original: 0.02)
af_max (simple float): Maximum acceleration factor (Wilder's original: 0.20)
Returns: SAR value (stop level for current trend)
fractals()
Detects Williams Fractal patterns (5-bar pattern)
Returns: Tuple [up_fractal, down_fractal] with fractal values (na if no fractal)
swings(lookback, source_high, source_low)
Detects swing highs and swing lows using lookback period
Parameters:
lookback (simple int): Number of bars on each side to confirm swing point
source_high (float): Price series for swing high detection (typically high)
source_low (float): Price series for swing low detection (typically low)
Returns: Tuple [swing_high, swing_low] with swing point values (na if no swing)
pivot(tf)
Calculates classic/standard/floor pivot points
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, r2, r3, s1, s2, s3] with pivot levels
pivotcam(tf)
Calculates Camarilla pivot points with 8 levels for short-term trading
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, r2, r3, r4, s1, s2, s3, s4] with pivot levels
pivotdem(tf)
Calculates d-mark pivot points with conditional open/close logic
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, s1] with pivot levels (only 3 levels)
pivotext(tf)
Calculates extended traditional pivot points with R4-R5 and S4-S5 levels
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, r2, r3, r4, r5, s1, s2, s3, s4, s5] with pivot levels
pivotfib(tf)
Calculates Fibonacci pivot points using Fibonacci ratios
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, r2, r3, s1, s2, s3] with pivot levels
pivotwood(tf)
Calculates Woodie's pivot points with weighted closing price
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, r2, r3, s1, s2, s3] with pivot levels
psar(af_start, af_increment, af_max)
Calculates Parabolic Stop And Reverse (SAR)
Parameters:
af_start (simple float): Initial acceleration factor (Wilder's original: 0.02)
af_increment (simple float): Acceleration factor increment per new extreme (Wilder's original: 0.02)
af_max (simple float): Maximum acceleration factor (Wilder's original: 0.20)
Returns: SAR value (stop level for current trend)
fractals()
Detects Williams Fractal patterns (5-bar pattern)
Returns: Tuple [up_fractal, down_fractal] with fractal values (na if no fractal)
swings(lookback, source_high, source_low)
Detects swing highs and swing lows using lookback period
Parameters:
lookback (simple int): Number of bars on each side to confirm swing point
source_high (float): Price series for swing high detection (typically high)
source_low (float): Price series for swing low detection (typically low)
Returns: Tuple [swing_high, swing_low] with swing point values (na if no swing)
pivot(tf)
Calculates classic/standard/floor pivot points
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, r2, r3, s1, s2, s3] with pivot levels
pivotcam(tf)
Calculates Camarilla pivot points with 8 levels for short-term trading
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, r2, r3, r4, s1, s2, s3, s4] with pivot levels
pivotdem(tf)
Calculates d-mark pivot points with conditional open/close logic
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, s1] with pivot levels (only 3 levels)
pivotext(tf)
Calculates extended traditional pivot points with R4-R5 and S4-S5 levels
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, r2, r3, r4, r5, s1, s2, s3, s4, s5] with pivot levels
pivotfib(tf)
Calculates Fibonacci pivot points using Fibonacci ratios
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, r2, r3, s1, s2, s3] with pivot levels
pivotwood(tf)
Calculates Woodie's pivot points with weighted closing price
Parameters:
tf (simple string): Timeframe for pivot calculation ("D", "W", "M")
Returns: Tuple [pp, r1, r2, r3, s1, s2, s3] with pivot levels
Biblioteka Pine
W zgodzie z duchem TradingView autor opublikował ten kod Pine jako bibliotekę open-source, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Ukłony dla autora. Można korzystać z tej biblioteki prywatnie lub w innych publikacjach open-source, jednak ponowne wykorzystanie tego kodu w publikacjach podlega Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Biblioteka Pine
W zgodzie z duchem TradingView autor opublikował ten kod Pine jako bibliotekę open-source, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Ukłony dla autora. Można korzystać z tej biblioteki prywatnie lub w innych publikacjach open-source, jednak ponowne wykorzystanie tego kodu w publikacjach podlega Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.