PINE LIBRARY

HarmonicPatternTracking

Library "HarmonicPatternTracking"
Library contains few data structures and methods for tracking harmonic pattern trades via pinescript.

method draw(this)
  Creates and draws HarmonicDrawing object for given HarmonicPattern
  Namespace types: HarmonicPattern
  Parameters:
    this (HarmonicPattern): HarmonicPattern object
  Returns: current HarmonicPattern object

method addTrade(this)
  calculates HarmonicTrade and sets trade object for HarmonicPattern
  Namespace types: HarmonicPattern
  Parameters:
    this (HarmonicPattern): HarmonicPattern object
  Returns: bool true if pattern trades are valid, false otherwise

method delete(this)
  Deletes drawing objects of HarmonicDrawing
  Namespace types: HarmonicDrawing
  Parameters:
    this (HarmonicDrawing): HarmonicDrawing object
  Returns: current HarmonicDrawing object

method delete(this)
  Deletes drawings of harmonic pattern
  Namespace types: HarmonicPattern
  Parameters:
    this (HarmonicPattern): HarmonicPattern object
  Returns: current HarmonicPattern object

HarmonicDrawing
  Drawing objects of Harmonic Pattern
  Fields:
    xa (series line): xa line
    ab (series line): ab line
    bc (series line): bc line
    cd (series line): cd line
    xb (series line): xb line
    bd (series line): bd line
    ac (series line): ac line
    xd (series line): xd line
    x (series label): label for pivot x
    a (series label): label for pivot a
    b (series label): label for pivot b
    c (series label): label for pivot c
    d (series label): label for pivot d
    xabRatio (series label): label for XAB Ratio
    abcRatio (series label): label for ABC Ratio
    bcdRatio (series label): label for BCD Ratio
    xadRatio (series label): label for XAD Ratio

HarmonicTrade
  Trade tracking parameters of Harmonic Patterns
  Fields:
    initialEntry (series float): initial entry when pattern first formed.
    entry (series float): trailed entry price.
    initialStop (series float): initial stop when trade first entered.
    stop (series float): current stop updated as per trailing rules.
    target1 (series float): First target value
    target2 (series float): Second target value
    target3 (series float): Third target value
    target4 (series float): Fourth target value
    status (series int): Trade status referenced as integer
    retouch (series bool): Flag to show if the price retouched after entry

HarmonicProperties
  Display and trade calculation properties for Harmonic Patterns
  Fields:
    fillMajorTriangles (series bool): Display property used for using linefill for harmonic major triangles
    fillMinorTriangles (series bool): Display property used for using linefill for harmonic minor triangles
    majorFillTransparency (series int): transparency setting for major triangles
    minorFillTransparency (series int): transparency setting for minor triangles
    showXABCD (series bool): Display XABCD pivot labels
    lblSizePivots (series string): Pivot label size
    showRatios (series bool): Display Ratio labels
    useLogScaleForScan (series bool): Use log scale to determine fib ratios for pattern scanning
    useLogScaleForTargets (series bool): Use log scale to determine fib ratios for target calculation
    base (series string): base on which calculation of stop/targets are made.
    entryRatio (series float): fib ratio to calculate entry
    stopRatio (series float): fib ratio to calculate initial stop
    target1Ratio (series float): fib ratio to calculate first target
    target2Ratio (series float): fib ratio to calculate second target
    target3Ratio (series float): fib ratio to calculate third target
    target4Ratio (series float): fib ratio to calculate fourth target

HarmonicPattern
  Harmonic pattern object to track entire pattern trade life cycle
  Fields:
    id (series int): Pattern Id
    dir (series int): pattern direction
    x (series float): X Pivot
    a (series float): A Pivot
    b (series float): B Pivot
    c (series float): C Pivot
    d (series float): D Pivot
    xBar (series int): Bar index of X Pivot
    aBar (series int): Bar index of A Pivot
    bBar (series int): Bar index of B Pivot
    cBar (series int): Bar index of C Pivot
    dBar (series int): Bar index of D Pivot
    przStart (series float): Start of PRZ range
    przEnd (series float): End of PRZ range
    patterns (bool[]): array representing the patterns
    patternLabel (series string): string representation of list of patterns
    patternColor (series color): color assigned to pattern
    properties (HarmonicProperties): HarmonicProperties object containing display and calculation properties
    trade (HarmonicTrade): HarmonicTrade object to track trades
    drawing (HarmonicDrawing): HarmonicDrawing object to manage drawings
arrayshewhomustnotbenamedMarket Geometrystatisticstrackingtrendoscope

Pine library

In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House rules.

Disclaimer