reees

Obj_XABCD_Harmonic

reees Mis à jour   
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
Notes de version:
v2
Fixed validation of incomplete patterns (i.e. when calling init() with no Point D coordinates)
Notes de version:
v3
Delete existing drawings on init()
Notes de version:
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
Notes de version:
v5
Notes de version:
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
Notes de version:
v7
Fixed bug when calling init with point D = na
Notes de version:
v8
Initialize point e on init()
Notes de version:
v9
Don't overwrite entry point when initializing an existing pattern
Notes de version:
v10

Bibliothèque Pine

Dans le véritable esprit de TradingView, l'auteur a publié ce code Pine en tant que bibliothèque open-source afin que d'autres programmeurs Pine de notre communauté puissent le réutiliser. Bravo à l'auteur ! Vous pouvez utiliser cette bibliothèque à titre privé ou dans d'autres publications open-source, mais la réutilisation de ce code dans une publication est régie par notre Règlement.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser cette bibliothèque?

Copiez le texte dans le presse-papiers et collez-le dans votre script.