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)
Nota Keluaran
v2 added methods to generate LineArgs and LabelArgs depending on Pivot mode
Added: 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)
Nota Keluaran
v3 added reference series into HLData for use in zigzags, added functions to generate LineArgs and LabelArgs based on Pivot mode
Updated: 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)
Nota Keluaran
v4 fixed calculation error
Nota Keluaran
v5 added shortcuts for extracting and using HLData via Point Object
Updated: 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)
v8 prevent neutral mode for follow up pivots, take opposite of previous direction in case of pivot has same price level as previous
Nota Keluaran
v9 added variables to tostring for debugging
Nota Keluaran
v10 added variables to tostring
Nota Keluaran
v11 auto-position pivot labels depending on mode
Nota Keluaran
v12 update to lib_plot_objects v8
Nota Keluaran
v13 changed default colors for HL/LH
Nota Keluaran
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
method add_next(id, point, max) Namespace types: Pivot[] Parameters: id (Pivot[]) point (Point type from robbatt/lib_plot_objects/8) max (int)
Nota Keluaran
v15 added same direction check in update_relation
Nota Keluaran
v16 added functions for management of Pivots in arrays, used to create Zigzag lines
Added: 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)
Nota Keluaran
v17 simplified initialization of pivot array, updated demo
Nota Keluaran
v18 improved error messages
Nota Keluaran
v19 refactored update mechanism of last Pivot[] item
Nota Keluaran
v20 fine tuned zigzag demo algorithm and unit tests
Nota Keluaran
v21 updated demo, including dashed lines for unconfirmed last leg
Nota Keluaran
v22 add direction cast to integer
Nota Keluaran
v23 removed debug outputs
Nota Keluaran
v24 update to lib_plot_objects v9
Nota Keluaran
v25 added shortcut for lib_zig
Nota Keluaran
v26 updated lib_plot_objects to v10
Nota Keluaran
v27 added Candle data to HLData for more precise calculation of Zigzag trend change
Updated: 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)
Nota Keluaran
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
Nota Keluaran
v29 added manual buffer to prevent max_bars_back compiler error, updated to lib_plot_objects using Candle objects
Nota Keluaran
v30 optimized HLData init, made HLData candle_buffer accessible, added function to get current_candle
Added: 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)
Nota Keluaran
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 usage
Nota Keluaran
v32 moved runtime error for adding wrong direction Pivot to add_next instead of update_relation
Nota Keluaran
v33 removed additional check
Nota Keluaran
v34 update to lib_plot_objects v13
Nota Keluaran
v35 version bump lib_plot_objects v14
Nota Keluaran
v36 version bump to lib_plot_objects v15
Nota Keluaran
v37 added argument to store candle data with pivot
Updated: 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)
Nota Keluaran
v38 version bump to lib_plot_objects v16
Nota Keluaran
v39 version bump lib_plot_objects v17
Nota Keluaran
v40 version bump lib_plot_objects v18
Nota Keluaran
v41 version bump lib_plot_objects v19
Nota Keluaran
v42 Added exceeded_by_any
Nota Keluaran
v43 update to lib_plot_objects v23
Nota Keluaran
v44 version bump to lib_plot_objects 25
Nota Keluaran
v45 update to lib_plot_objects v32 and switch to chart.point objects instead of calculation via x/y coordinates
Nota Keluaran
v46 version bump lib_plot_objects v33
Nota Keluaran
v47 version bump lib_plot_objects v34
Nota Keluaran
v48 version bump lib_plot_objects v35
Nota Keluaran
v49 version bump to lib_plot_objects v36
Nota Keluaran
v50 added init function to initialize Pivot arrays on creation, added add_next to directly add Pivot objects
Added: 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)
Nota Keluaran
v51 added force_update parameter to update_last, to allow for better control on custom zigzags
Updated: 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)
Nota Keluaran
v52 simplified create_next functions, providing default candle parameter value
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai satu perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.