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
مكتبة باين
كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشورات تخضع لقواعد الموقع.
إخلاء المسؤولية
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
مكتبة باين
كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشورات تخضع لقواعد الموقع.
إخلاء المسؤولية
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.