reees

Obj_XABCD_Harmonic

reees Cập nhật   
Library "Obj_XABCD_Harmonic"
Harmonic XABCD Pattern object and associated methods. Easily validate, draw, and get information about harmonic patterns. See example code at the end of the script for details.

init_params(pct_error, pct_asym, types, w_e, w_p, w_d)
  Create a harmonic parameters object (used by xabcd_harmonic object for pattern validation and scoring).
  Parameters:
    pct_error: Allowed % error of leg retracement ratio versus the defined harmonic ratio
    pct_asym: Allowed leg length/period asymmetry % (a leg is considered invalid if it is this % longer or shorter than the average length of the other legs)
    types: Array of pattern types to validate (1=Gartley, 2=Bat, 3=Butterfly, 4=Crab, 5=Shark, 6=Cypher)
    w_e: Weight of ratio % error (used in score calculation, dft = 1)
    w_p: Weight of PRZ confluence (used in score calculation, dft = 1)
    w_d: Weight of Point D / PRZ confluence (used in score calculation, dft = 1)
  Returns: harmonic_params object instance. It is recommended to store and reuse this object for multiple xabcd_harmonic objects rather than creating new params objects unnecessarily.

init(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY, params, tp, p)
  Initialize an xabcd_harmonic object instance.
If the pattern is valid, an xabcd_harmonic object instance is returned. If you want to specify your
own validation and scoring parameters, you can do so by passing a harmonic_params object (params).
Or, if you prefer to do your own validation, you can explicitly pass the harmonic pattern type (tp)
and validation will be skipped. You can also pass in an existing xabcd_harmonic instance if you wish
to re-initialize it (e.g. for re-validation and/or re-scoring).
  Parameters:
    xX: Point X bar index
    xY: Point X price/level
    aX: Point A bar index
    aY: Point A price/level
    bX: Point B bar index
    bY: Point B price/level
    cX: Point C bar index
    cY: Point C price/level
    dX: Point D bar index
    dY: Point D price/level
    params: harmonic_params used to validate and score the pattern. Validation will be skipped if a type (tp) is explicitly passed in.
    tp: Pattern type
    p: xabcd_harmonic object instance to initialize (optional, for re-validation/re-scoring)
  Returns: xabcd_harmonic object instance if a valid harmonic, else na

get_name(p)
  Get the pattern name
  Parameters:
    p: Instance of xabcd_harmonic object
  Returns: Pattern name (string)

get_symbol(p)
  Get the pattern symbol
  Parameters:
    p: Instance of xabcd_harmonic object
  Returns: Pattern symbol (1 byte string)

get_pid(p)
  Get the Pattern ID. Patterns of the same type with the same coordinates will have the same Pattern ID.
  Parameters:
    p: Instance of xabcd_harmonic object
  Returns: Pattern ID (string)

set_target(p, target, target_lvl, calc_target)
  Set value for a target. Use the calc_target parameter to automatically calculate the target for a specific harmonic ratio.
  Parameters:
    p: Instance of xabcd_harmonic object
    target: Target (1 or 2)
    target_lvl: Target price/level (required if calc_target is not specified)
    calc_target: Target to auto calculate (required if target is not specified)
Options:
  Returns: Target price/level (float)

erase_pattern(p)
  Erase the pattern
  Parameters:
    p: Instance of xabcd_harmonic object
  Returns: p

draw_pattern(p)
  Draw the pattern
  Parameters:
    p: Instance of xabcd_harmonic object
  Returns: Pattern lines


erase_label(p)
  Erase the pattern label
  Parameters:
    p: Instance of xabcd_harmonic object
  Returns: p

draw_label(p, txt, tooltip, clr, txt_clr)
  Draw the pattern label. Default text is the pattern name.
  Parameters:
    p: Instance of xabcd_harmonic object
    txt: Label text
    tooltip: Tooltip text
    clr: Label color
    txt_clr: Text color
  Returns: Label

harmonic_params
  Validation and scoring parameters for a Harmonic Pattern object (xabcd_harmonic)
  Fields:
    pct_error: Allowed % error of leg retracement ratio versus the defined harmonic ratio
    pct_asym
    types
    w_e
    w_p
    w_d

xabcd_harmonic
  Harmonic Pattern object
  Fields:
    bull: Bullish pattern flag
    tp
    xX
    xY
    aX
    aY
    bX
    bY
    cX
    cY
    dX
    dY
    r_xb
    re_xb
    r_ac
    re_ac
    r_bd
    re_bd
    r_xd
    re_xd
    score
    score_eAvg
    score_prz
    score_eD
    prz_bN
    prz_bF
    prz_xN
    prz_xF
    t1Hit: Target 1 flag
    t1
    t2Hit
    t2
    sHit: Stop flag
    stop: Stop level
    entry: Entry level
    eHit
    eX
    eY
    pLines
    pLabel
    pid
    params
Phát hành các Ghi chú:
v2
Fixed validation of incomplete patterns (i.e. when calling init() with no Point D coordinates)
Phát hành các Ghi chú:
v3
Delete existing drawings on init()
Phát hành các Ghi chú:
v4

Updated:
xabcd_harmonic
  Harmonic Pattern object
  Fields:
    bull: Bullish pattern flag
    tp
    xX
    xY
    aX
    aY
    bX
    bY
    cX
    cY
    dX
    dY
    r_xb
    re_xb
    r_ac
    re_ac
    r_bd
    re_bd
    r_xd
    re_xd
    score
    score_eAvg
    score_prz
    score_eD
    prz_bN
    prz_bF
    prz_xN
    prz_xF
    t1Hit: Target 1 flag
    t1
    t2Hit
    t2
    sHit: Stop flag
    stop: Stop level
    entry: Entry level
    eHit
    eX
    eY
    invalid_d
    pLines
    pLabel
    pid
    params
Phát hành các Ghi chú:
v5
Phát hành các Ghi chú:
v6

Updated to use point, leg, and pattern objects.

Updated:
init(pattern, params, tp, p)
  Initialize an xabcd_harmonic object instance from a given pattern
If the pattern is valid, an xabcd_harmonic object instance is returned. If you want to specify your
own validation and scoring parameters, you can do so by passing a harmonic_params object (params).
Or, if you prefer to do your own validation, you can explicitly pass the harmonic pattern type (tp)
and validation will be skipped. You can also pass in an existing xabcd_harmonic instance if you wish
to re-initialize it (e.g. for re-validation and/or re-scoring).
  Parameters:
    pattern: Pattern
    params: harmonic_params used to validate and score the pattern. Validation will be skipped if a type (tp) is explicitly passed in.
    tp: Pattern type
    p: xabcd_harmonic object instance to initialize (optional, for re-validation/re-scoring)
  Returns: xabcd_harmonic object instance if a valid harmonic, else na

xabcd_harmonic
  Harmonic Pattern object
  Fields:
    bull: Bullish pattern flag
    tp
    x
    a
    b
    c
    d
    r_xb
    re_xb
    r_ac
    re_ac
    r_bd
    re_bd
    r_xd
    re_xd
    score
    score_eAvg
    score_prz
    score_eD
    prz_bN
    prz_bF
    prz_xN
    prz_xF
    t1Hit: Target 1 flag
    t1
    t2Hit
    t2
    sHit: Stop flag
    stop: Stop level
    entry: Entry level
    eHit
    e
    invalid_d
    pLines
    pLabel
    pid
    params
Phát hành các Ghi chú:
v7
Fixed bug when calling init with point D = na
Phát hành các Ghi chú:
v8
Initialize point e on init()
Phát hành các Ghi chú:
v9
Don't overwrite entry point when initializing an existing pattern
Phát hành các Ghi chú:
v10

Thư viện Pine

Với tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này như một thư viện mã nguồn mở để các lập trình viên Pine khác từ cộng đồng của chúng tôi có thể sử dụng lại nó. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này một cách riêng tư hoặc trong các ấn phẩm mã nguồn mở khác, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của 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.

Bạn muốn sử dụng thư viện này?

Sao chép văn bản vào khay nhớ tạm và dán nó vào tập lệnh của bạn.