TradingView
Trendoscope
12. Febr. 2022 17:45

eHarmonicpatternsExtended 

Amazon.com, Inc.NASDAQ

Beschreibung

Library "eHarmonicpatternsExtended"
Library provides an alternative method to scan harmonic patterns. This is helpful in reducing iterations. Republishing as new library instead of existing eHarmonicpatterns because I need that copy for existing scripts.

scan_xab(bcdRatio, err_min, err_max, patternArray) Checks if bcd ratio is in range of any harmonic pattern
  Parameters:
    bcdRatio: AB/XA ratio
    err_min: minimum error threshold
    err_max: maximum error threshold
    patternArray: Array containing pattern check flags. Checks are made only if flags are true. Upon check flgs are overwritten.

scan_abc_axc(abcRatio, axcRatio, err_min, err_max, patternArray) Checks if abc or axc ratio is in range of any harmonic pattern
  Parameters:
    abcRatio: BC/AB ratio
    axcRatio: XC/AX ratio
    err_min: minimum error threshold
    err_max: maximum error threshold
    patternArray: Array containing pattern check flags. Checks are made only if flags are true. Upon check flgs are overwritten.

scan_bcd(bcdRatio, err_min, err_max, patternArray) Checks if bcd ratio is in range of any harmonic pattern
  Parameters:
    bcdRatio: CD/BC ratio
    err_min: minimum error threshold
    err_max: maximum error threshold
    patternArray: Array containing pattern check flags. Checks are made only if flags are true. Upon check flgs are overwritten.

scan_xad_xcd(xadRatio, xcdRatio, err_min, err_max, patternArray) Checks if xad or xcd ratio is in range of any harmonic pattern
  Parameters:
    xadRatio: AD/XA ratio
    xcdRatio: CD/XC ratio
    err_min: minimum error threshold
    err_max: maximum error threshold
    patternArray: Array containing pattern check flags. Checks are made only if flags are true. Upon check flgs are overwritten.

isHarmonicPattern(x, a, b, c, d, flags, errorPercent) Checks for harmonic patterns
  Parameters:
    x: X coordinate value
    a: A coordinate value
    b: B coordinate value
    c: C coordinate value
    d: D coordinate value
    flags: flags to check patterns. Send empty array to enable all
    errorPercent: Error threshold
  Returns: [patternArray, patternLabelArray] Array of boolean values which says whether valid pattern exist and array of corresponding pattern names

isHarmonicProjection(x, a, b, c, flags, errorPercent) Checks for harmonic pattern projection
  Parameters:
    x: X coordinate value
    a: A coordinate value
    b: B coordinate value
    c: C coordinate value
    flags: flags to check patterns. Send empty array to enable all
    errorPercent: Error threshold
  Returns: [patternArray, patternLabelArray] Array of boolean values which says whether valid pattern exist and array of corresponding pattern names.

get_prz_range(x, a, b, c, patternArray, errorPercent, start_adj, end_adj) Provides PRZ range based on BCD and XAD ranges
  Parameters:
    x: X coordinate value
    a: A coordinate value
    b: B coordinate value
    c: C coordinate value
    patternArray: Pattern flags for which PRZ range needs to be calculated
    errorPercent: Error threshold
    start_adj: - Adjustments for entry levels
    end_adj: - Adjustments for stop levels
  Returns: [dStart, dEnd] Start and end of consolidated PRZ range

get_prz_range_xad(x, a, b, c, patternArray, errorPercent, start_adj, end_adj) Provides PRZ range based on XAD range only
  Parameters:
    x: X coordinate value
    a: A coordinate value
    b: B coordinate value
    c: C coordinate value
    patternArray: Pattern flags for which PRZ range needs to be calculated
    errorPercent: Error threshold
    start_adj: - Adjustments for entry levels
    end_adj: - Adjustments for stop levels
  Returns: [dStart, dEnd] Start and end of consolidated PRZ range

Versionshinweise

v2

Minor correction :(

Versionshinweise

v3

Added:
getSupportedPatterns(patternLabelArray) Returns the list of supported patterns in order
  Parameters:
    patternLabelArray: Supported Patterns

get_projection_range(x, a, b, c, patternArray, errorPercent, start_adj, end_adj) Provides Projection range based on BCD and XAD ranges
  Parameters:
    x: X coordinate value
    a: A coordinate value
    b: B coordinate value
    c: C coordinate value
    patternArray: Pattern flags for which PRZ range needs to be calculated
    errorPercent: Error threshold
    start_adj: - Adjustments for entry levels
    end_adj: - Adjustments for stop levels
  Returns: [startRange, endRange] Array containing start and end ranges

Versionshinweise

v4

Versionshinweise

v5

Removed:
scan_xab(bcdRatio, err_min, err_max, patternArray)
  Checks if bcd ratio is in range of any harmonic pattern

scan_abc_axc(abcRatio, axcRatio, err_min, err_max, patternArray)
  Checks if abc or axc ratio is in range of any harmonic pattern

scan_bcd(bcdRatio, err_min, err_max, patternArray)
  Checks if bcd ratio is in range of any harmonic pattern

scan_xad_xcd(xadRatio, xcdRatio, err_min, err_max, patternArray)
  Checks if xad or xcd ratio is in range of any harmonic pattern

Versionshinweise

v6

Minor logical updates
Kommentare
navrang081
not load
Trendoscope
@navrang081, it’s not an indicator. It’s library for developers.
lzhqlj5406207
Thank you for your help
Float x = 316.53
Float a = 327.91
Float b = 322.22
Float c = 326.36
I type xABC and get index 24 (patternLabelArray, "Total"). Does Total mean that all patterns can occur?
lzhqlj5406207
errorPercent = input.int(8, group="Miscellaneous")
float x=370.32
float a=383.2
float b=373.67
float c=380.09
patterns =s.isHarmonicProjection(x,a,b,c,flags, errorPercent = errorPercent)
------------------
Thanks for your library, I have A problem with the above code, I want to type X A B C, call isHarmonicProjection, the result shows Syntax error at input 'int'. May I ask what the reason is?
My intention is to enter the XABC indicator and predict point D.
Trendoscope
@lzhqlj5406207, Have you defined the flags?
lzhqlj5406207
@HeWhoMustNotBeNamed, Thank you very much for your reply. I have defined it
-----------------
flags = array.new_bool()
array.push(flags, enableGartley)
array.push(flags, enableCrab)
array.push(flags, enableDeepCrab)
array.push(flags, enableBat)
array.push(flags, enableButterfly)
array.push(flags, enableShark)
array.push(flags, enableCypher)
array.push(flags, enableNenStar)

array.push(flags, enableAntiNenStar)
array.push(flags, enableAntiShark)
array.push(flags, enableAntiCypher)
array.push(flags, enableAntiCrab)
array.push(flags, enableAntiButterfly)
array.push(flags, enableAntiBat)
array.push(flags, enableAntiGartley)
array.push(flags, enableNavarro200)

array.push(flags, enableFiveZero)
array.push(flags, enableThreeDrives)
array.push(flags, enableWhiteSwann)
array.push(flags, enableBlackSwann)
array.push(flags, enableSeaPony)
array.push(flags, enableLeonardo)
array.push(flags, enableOneTwoOne)
array.push(flags, enableSnorm)
array.push(flags, enableTotal)
float x=370.32
float a=383.2
float b=373.67
float c=380.09

patterns =s.isHarmonicProjection(x,a,b,c,flags, errorPercent = errorPercent)
Trendoscope
@lzhqlj5406207, I just did this and it is working ok.
indicator('deleteme', overlay=true) import HeWhoMustNotBeNamed/eHarmonicpatternsExtended/4 as s errorPercent = input.int(8, group="Miscellaneous") flags = array.new_bool(25, true) float x=370.32 float a=383.2 float b=373.67 float c=380.09 patterns =s.isHarmonicProjection(x,a,b,c,flags, errorPercent = errorPercent) plot(close)
lzhqlj5406207
@HeWhoMustNotBeNamed, Thank you very much for your answer, which is very helpful for novices. Another problem that has been bothering me for a long time is that I want to display the return value in the table,-----------------------
string s=array.get(patterns,0)
table.cell(tab1, 0, 1, s , text_halign = text.align_left, text_size= size.normal, text_color=color.white)
--------
Declared type string is not compatible with assigned type series bool
Trendoscope
@lzhqlj5406207, you need to convert that bool to string. If patterns(0) is true, Gartley, pattern(1) is true, Crab etc.
lzhqlj5406207
Mehr