PINE LIBRARY
Cập nhật lib_pivot

Library "lib_pivot"
Object oriented implementation of Pivot methods.
method tostring(this)
Converts HLData to a json string representation
Namespace types: HLData
Parameters:
this (HLData): HLData
Returns: string representation of Pivot
method tostring(this, date_format)
Namespace types: Pivot
Parameters:
this (Pivot)
date_format (simple string)
method tostring(this, date_format)
Namespace types: Pivot[]
Parameters:
this (Pivot[])
date_format (simple string)
method get_color(this, mode)
Namespace types: PivotColors
Parameters:
this (PivotColors)
mode (int)
method get_label_text(this)
Namespace types: Pivot
Parameters:
this (Pivot)
method direction(this)
Namespace types: Pivot
Parameters:
this (Pivot)
method same_direction_as(this, other)
Namespace types: Pivot
Parameters:
this (Pivot)
other (Pivot)
method exceeds(this, price)
Namespace types: Pivot
Parameters:
this (Pivot)
price (float)
method exceeds(this, other)
Namespace types: Pivot
Parameters:
this (Pivot)
other (Pivot)
method exceeded_by(this, price)
Namespace types: Pivot
Parameters:
this (Pivot)
price (float)
method exceeded_by(this, other)
Namespace types: Pivot
Parameters:
this (Pivot)
other (Pivot)
method retracement_ratio(this, lastPivot, sec_lastPivot)
Namespace types: Pivot
Parameters:
this (Pivot)
lastPivot (Pivot)
sec_lastPivot (Pivot)
ratio_target(sec_lastPivot, lastPivot, target_ratio)
Parameters:
sec_lastPivot (Pivot)
lastPivot (Pivot)
target_ratio (float)
method update(this, ref_highest, ref_lowest)
Namespace types: HLData
Parameters:
this (HLData)
ref_highest (float)
ref_lowest (float)
method update(this, bar_time, bar_idx, price, prev)
Namespace types: Pivot
Parameters:
this (Pivot)
bar_time (int)
bar_idx (int)
price (float)
prev (Pivot)
method create_next(this, bar_time, bar_idx, price)
Namespace types: Pivot
Parameters:
this (Pivot)
bar_time (int)
bar_idx (int)
price (float)
HLData
HLData wraps the data received from ta.highest, ta.highestbars, ta.lowest, ta.lowestbars, as well as the reference sources
Fields:
length (series int): lookback length for pivot points
highest_offset (series int): offset to highest value bar
lowest_offset (series int): offset to lowest value bar
highest (series float): highest value within lookback bars
lowest (series float): lowest value within lookback bars
new_highest (series bool): update() will set this true if the current candle forms a new highest high at the last (current) bar of set period (length)
new_lowest (series bool): update() will set this true if the current candle forms a new lowest low at the last (current) bar of set period (length)
new_highest_fractal (series bool): update() will set this true if the current candle forms a new fractal high at the center of set period (length)
new_lowest_fractal (series bool): update() will set this true if the current candle forms a new fractal low at the center of set period (length)
PivotColors
Pivot colors for different modes
Fields:
hh (series color): Color for Pivot mode 2 (HH)
lh (series color): Color for Pivot mode 1 (LH)
hl (series color): Color for Pivot mode -1 (HL)
ll (series color): Color for Pivot mode -2 (LL)
Pivot
Pivot additional pivot data around basic Point
Fields:
point (Point type from robbatt/lib_plot_objects/5)
mode (series int): can be -2/-1/1/2 for LL/HL/LH/HH
price_movement (series float): The price difference between this and the previous pivot point in the opposite direction
retracement_ratio (series float): The ratio between this price_movement and the previous
prev (Pivot)
Object oriented implementation of Pivot methods.
method tostring(this)
Converts HLData to a json string representation
Namespace types: HLData
Parameters:
this (HLData): HLData
Returns: string representation of Pivot
method tostring(this, date_format)
Namespace types: Pivot
Parameters:
this (Pivot)
date_format (simple string)
method tostring(this, date_format)
Namespace types: Pivot[]
Parameters:
this (Pivot[])
date_format (simple string)
method get_color(this, mode)
Namespace types: PivotColors
Parameters:
this (PivotColors)
mode (int)
method get_label_text(this)
Namespace types: Pivot
Parameters:
this (Pivot)
method direction(this)
Namespace types: Pivot
Parameters:
this (Pivot)
method same_direction_as(this, other)
Namespace types: Pivot
Parameters:
this (Pivot)
other (Pivot)
method exceeds(this, price)
Namespace types: Pivot
Parameters:
this (Pivot)
price (float)
method exceeds(this, other)
Namespace types: Pivot
Parameters:
this (Pivot)
other (Pivot)
method exceeded_by(this, price)
Namespace types: Pivot
Parameters:
this (Pivot)
price (float)
method exceeded_by(this, other)
Namespace types: Pivot
Parameters:
this (Pivot)
other (Pivot)
method retracement_ratio(this, lastPivot, sec_lastPivot)
Namespace types: Pivot
Parameters:
this (Pivot)
lastPivot (Pivot)
sec_lastPivot (Pivot)
ratio_target(sec_lastPivot, lastPivot, target_ratio)
Parameters:
sec_lastPivot (Pivot)
lastPivot (Pivot)
target_ratio (float)
method update(this, ref_highest, ref_lowest)
Namespace types: HLData
Parameters:
this (HLData)
ref_highest (float)
ref_lowest (float)
method update(this, bar_time, bar_idx, price, prev)
Namespace types: Pivot
Parameters:
this (Pivot)
bar_time (int)
bar_idx (int)
price (float)
prev (Pivot)
method create_next(this, bar_time, bar_idx, price)
Namespace types: Pivot
Parameters:
this (Pivot)
bar_time (int)
bar_idx (int)
price (float)
HLData
HLData wraps the data received from ta.highest, ta.highestbars, ta.lowest, ta.lowestbars, as well as the reference sources
Fields:
length (series int): lookback length for pivot points
highest_offset (series int): offset to highest value bar
lowest_offset (series int): offset to lowest value bar
highest (series float): highest value within lookback bars
lowest (series float): lowest value within lookback bars
new_highest (series bool): update() will set this true if the current candle forms a new highest high at the last (current) bar of set period (length)
new_lowest (series bool): update() will set this true if the current candle forms a new lowest low at the last (current) bar of set period (length)
new_highest_fractal (series bool): update() will set this true if the current candle forms a new fractal high at the center of set period (length)
new_lowest_fractal (series bool): update() will set this true if the current candle forms a new fractal low at the center of set period (length)
PivotColors
Pivot colors for different modes
Fields:
hh (series color): Color for Pivot mode 2 (HH)
lh (series color): Color for Pivot mode 1 (LH)
hl (series color): Color for Pivot mode -1 (HL)
ll (series color): Color for Pivot mode -2 (LL)
Pivot
Pivot additional pivot data around basic Point
Fields:
point (Point type from robbatt/lib_plot_objects/5)
mode (series int): can be -2/-1/1/2 for LL/HL/LH/HH
price_movement (series float): The price difference between this and the previous pivot point in the opposite direction
retracement_ratio (series float): The ratio between this price_movement and the previous
prev (Pivot)
Phát hành các Ghi chú
v2 added methods to generate LineArgs and LabelArgs depending on Pivot modeAdded:
method get_line_args(this, mode, base_line_args)
Namespace types: PivotColors
Parameters:
this (PivotColors)
mode (int)
base_line_args (LineArgs type from robbatt/lib_plot_objects/5)
method get_label_args(this, mode, base_label_args, bg_colors)
Namespace types: PivotColors
Parameters:
this (PivotColors)
mode (int)
base_label_args (LabelArgs type from robbatt/lib_plot_objects/5)
bg_colors (PivotColors)
Phát hành các Ghi chú
v3 added reference series into HLData for use in zigzags, added functions to generate LineArgs and LabelArgs based on Pivot modeUpdated:
method get_line_args(this, mode, base_line_args)
Namespace types: PivotColors
Parameters:
this (PivotColors)
mode (int)
base_line_args (LineArgs type from robbatt/lib_plot_objects/6)
method get_label_args(this, mode, base_label_args, bg_colors)
Namespace types: PivotColors
Parameters:
this (PivotColors)
mode (int)
base_label_args (LabelArgs type from robbatt/lib_plot_objects/6)
bg_colors (PivotColors)
HLData
new Fields:
ref_highest (series float)
ref_lowest (series float)
Phát hành các Ghi chú
v4 fixed calculation errorPhát hành các Ghi chú
v5 added shortcuts for extracting and using HLData via Point ObjectUpdated:
method update(this, update, prev)
Namespace types: Pivot
Parameters:
this (Pivot)
update (Point type from robbatt/lib_plot_objects/6)
prev (Pivot)
method create_next(this, update)
Namespace types: Pivot
Parameters:
this (Pivot)
update (Point type from robbatt/lib_plot_objects/6)
HLData
added Fields:
h (Point type from robbatt/lib_plot_objects/6)
l (Point type from robbatt/lib_plot_objects/6)
Phát hành các Ghi chú
v6 update lib_plot_objects to v7Phát hành các Ghi chú
v7 added default xloc to HLData Updated:
HLData
added Fields:
xloc (series string)
Phát hành các Ghi chú
v8 prevent neutral mode for follow up pivots, take opposite of previous direction in case of pivot has same price level as previousPhát hành các Ghi chú
v9 added variables to tostring for debuggingPhát hành các Ghi chú
v10 added variables to tostringPhát hành các Ghi chú
v11 auto-position pivot labels depending on modePhát hành các Ghi chú
v12 update to lib_plot_objects v8Phát hành các Ghi chú
v13 changed default colors for HL/LHPhát hành các Ghi chú
v14 added methods update_relation: to calculate all values relating to another pivot point
add_next: doing that automatically when adding a Pivot to an array of Pivots
Added:
method update_relation(this, prev)
Namespace types: Pivot
Parameters:
this (Pivot)
prev (Pivot)
method add_next(id, point, max)
Namespace types: Pivot[]
Parameters:
id (Pivot[])
point (Point type from robbatt/lib_plot_objects/8)
max (int)
Phát hành các Ghi chú
v15 added same direction check in update_relationPhát hành các Ghi chú
v16 added functions for management of Pivots in arrays, used to create Zigzag linesAdded:
method update_last(id, update)
Namespace types: Pivot[]
Parameters:
id (Pivot[])
update (Point type from robbatt/lib_plot_objects/8)
method update_last_or_add_next(id, point)
Namespace types: Pivot[]
Parameters:
id (Pivot[])
point (Point type from robbatt/lib_plot_objects/8)
Phát hành các Ghi chú
v17 simplified initialization of pivot array, updated demoPhát hành các Ghi chú
v18 improved error messagesPhát hành các Ghi chú
v19 refactored update mechanism of last Pivot[] itemPhát hành các Ghi chú
v20 fine tuned zigzag demo algorithm and unit testsPhát hành các Ghi chú
v21 updated demo, including dashed lines for unconfirmed last legPhát hành các Ghi chú
v22 add direction cast to integerPhát hành các Ghi chú
v23 removed debug outputsPhát hành các Ghi chú
v24 update to lib_plot_objects v9Phát hành các Ghi chú
v25 added shortcut for lib_zigPhát hành các Ghi chú
v26 updated lib_plot_objects to v10Phát hành các Ghi chú
v27 added Candle data to HLData for more precise calculation of Zigzag trend changeUpdated:
HLData
HLData wraps the data received from ta.highest, ta.highestbars, ta.lowest, ta.lowestbars, as well as the reference sources
Fields:
lowest_candle (Candle type from robbatt/lib_plot_objects/11)
highest_candle (Candle type from robbatt/lib_plot_objects/11)
h (Point type from robbatt/lib_plot_objects/11)
l (Point type from robbatt/lib_plot_objects/11)
Phát hành các Ghi chú
v28 renamed HLData h and l to highest_point and lowest_point, to prevent mixup with highest_candle.h and lowest_candle.l added candle data to HLData tostring
Updated:
HLData
HLData wraps the data received from ta.highest, ta.highestbars, ta.lowest, ta.lowestbars, as well as the reference sources
Fields:
highest_point (Point type from robbatt/lib_plot_objects/11): data of the highest point within lookback bars
lowest_point (Point type from robbatt/lib_plot_objects/11): data of the lowest point within lookback bars
Phát hành các Ghi chú
v29 added manual buffer to prevent max_bars_back compiler error, updated to lib_plot_objects using Candle objectsPhát hành các Ghi chú
v30 optimized HLData init, made HLData candle_buffer accessible, added function to get current_candleAdded:
method current_candle(this)
Namespace types: HLData
Parameters:
this (HLData)
Updated:
HLData
HLData wraps the data received from ta.highest, ta.highestbars, ta.lowest, ta.lowestbars, as well as the reference sources
Fields:
candle_buffer (Candle[] type from robbatt/lib_plot_objects/12)
Phát hành các Ghi chú
v31 refactored function signature of retracement_ratio from Pivot.retracement_ration(last_pivot, sec_last_pivot) to (sec_last_pivot, last_pivot) to match other functions and more intuitive usagePhát hành các Ghi chú
v32 moved runtime error for adding wrong direction Pivot to add_next instead of update_relationPhát hành các Ghi chú
v33 removed additional checkPhát hành các Ghi chú
v34 update to lib_plot_objects v13Phát hành các Ghi chú
v35 version bump lib_plot_objects v14Phát hành các Ghi chú
v36 version bump to lib_plot_objects v15Phát hành các Ghi chú
v37 added argument to store candle data with pivotUpdated:
method update(this, update, prev, candle)
Namespace types: Pivot
Parameters:
candle (Candle type from robbatt/lib_plot_objects/15)
method create_next(this, update, candle)
Namespace types: Pivot
Parameters:
this (Pivot)
update (Point type from robbatt/lib_plot_objects/15)
candle (Candle type from robbatt/lib_plot_objects/15)
method add_next(id, point, max, candle)
Namespace types: Pivot[]
Parameters:
id (Pivot[])
point (Point type from robbatt/lib_plot_objects/15)
max (int)
candle (Candle type from robbatt/lib_plot_objects/15)
method update_last(id, update, candle)
Namespace types: Pivot[]
Parameters:
id (Pivot[])
update (Point type from robbatt/lib_plot_objects/15)
candle (Candle type from robbatt/lib_plot_objects/15)
method update_last_or_add_next(id, point, max, candle)
Namespace types: Pivot[]
Parameters:
id (Pivot[])
point (Point type from robbatt/lib_plot_objects/15)
max (int)
candle (Candle type from robbatt/lib_plot_objects/15)
Pivot
Pivot additional pivot data around basic Point
Fields:
point (Point type from robbatt/lib_plot_objects/15)
mode (series int): can be -2/-1/1/2 for LL/HL/LH/HH
price_movement (series float): The price difference between this and the previous pivot point in the opposite direction
retracement_ratio (series float): The ratio between this price_movement and the previous
prev (Pivot)
candle (Candle type from robbatt/lib_plot_objects/15)
Phát hành các Ghi chú
v38 version bump to lib_plot_objects v16Phát hành các Ghi chú
v39 version bump lib_plot_objects v17Phát hành các Ghi chú
v40 version bump lib_plot_objects v18Phát hành các Ghi chú
v41 version bump lib_plot_objects v19Phát hành các Ghi chú
v42 Added exceeded_by_anyPhát hành các Ghi chú
v43 update to lib_plot_objects v23Phát hành các Ghi chú
v44 version bump to lib_plot_objects 25Phát hành các Ghi chú
v45 update to lib_plot_objects v32 and switch to chart.point objects instead of calculation via x/y coordinatesPhát hành các Ghi chú
v46 version bump lib_plot_objects v33Phát hành các Ghi chú
v47 version bump lib_plot_objects v34Phát hành các Ghi chú
v48 version bump lib_plot_objects v35Phát hành các Ghi chú
v49 version bump to lib_plot_objects v36Phát hành các Ghi chú
v50 added init function to initialize Pivot arrays on creation, added add_next to directly add Pivot objectsAdded:
method init(id)
Namespace types: Pivot[]
Parameters:
id (Pivot[])
Updated:
method add_next(id, point, candle, max)
Namespace types: Pivot[]
Parameters:
id (Pivot[])
point (chart.point)
candle (Candle type from robbatt/lib_plot_objects/36)
max (int)
method update_last_or_add_next(id, point, candle, max)
Namespace types: Pivot[]
Parameters:
id (Pivot[])
point (chart.point)
candle (Candle type from robbatt/lib_plot_objects/36)
max (int)
Phát hành các Ghi chú
v51 added force_update parameter to update_last, to allow for better control on custom zigzagsUpdated:
method update_last(id, update, candle, force_update)
Namespace types: Pivot[]
Parameters:
id (Pivot[])
update (chart.point)
candle (Candle type from robbatt/lib_plot_objects/36)
force_update (bool)
Phát hành các Ghi chú
v52 simplified create_next functions, providing default candle parameter valuePhát hành các Ghi chú
v53 refactoring- adapted to lib_plot_objects v50
- removed tostring methods (and simplified some error messages due to that)
- renamed get_line_args to create_line_args
- renamed get_label_args to create_label_args
- removed test code
Phát hành các Ghi chú
v54 upgrade to lib_plot_objects v56Thư viện Pine
Theo tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này dưới dạng thư viện nguồn mở để các lập trình viên Pine khác trong cộng đồng của chúng tôi có thể sử dụng lại. Xin tri ân tác giả! Bạn có thể sử dụng thư viện này riêng tư hoặc trong các bài đăng nguồn mở khác. Tuy nhiên, bạn cần sử dụng lại mã này theo Nội quy chung.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Thư viện Pine
Theo tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này dưới dạng thư viện nguồn mở để các lập trình viên Pine khác trong cộng đồng của chúng tôi có thể sử dụng lại. Xin tri ân tác giả! Bạn có thể sử dụng thư viện này riêng tư hoặc trong các bài đăng nguồn mở khác. Tuy nhiên, bạn cần sử dụng lại mã này theo Nội quy chung.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.