reees

Obj_XABCD_Harmonic

reees 업데이트됨   
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
릴리즈 노트:
v2
Fixed validation of incomplete patterns (i.e. when calling init() with no Point D coordinates)
릴리즈 노트:
v3
Delete existing drawings on init()
릴리즈 노트:
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
릴리즈 노트:
v5
릴리즈 노트:
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
릴리즈 노트:
v7
Fixed bug when calling init with point D = na
릴리즈 노트:
v8
Initialize point e on init()
릴리즈 노트:
v9
Don't overwrite entry point when initializing an existing pattern
릴리즈 노트:
v10

파인 라이브러리

트레이딩뷰 정신에 따라 오써는 이 파인 코드를 오픈 소스 라이브러리로 퍼블리쉬하여 당사 커뮤니티의 다른 파인 프로그래머들이 쓸 수 있도록 하였습니다. 오써에게 찬사를! 여러분은 이 라이브러리를 프라이빗 또는 오픈 소스 퍼블리케이션에 쓸 수 있지만 퍼블리케이션에 재사용은 하우스룰을 따릅니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

이 라이브러리를 쓰시겠습니까?

텍스트를 클립보드에 카피한 뒤 님의 스크립트에 붙여 넣기.