Library "cphelper"
ACPU helper library - for private use. Not so meaningful for others.

calculate_rr(targetArray, rrArray, breakevenOnTarget1)
  calculates risk reward for given targets
  Parameters:
    targetArray (float): array of targets
    rrArray (float): array of risk reward
    breakevenOnTarget1 (simple bool): option to breakeven
  Returns: array<float> rrArray

trendPairs(l1StartX, l1StartY, l1EndX, l1EndY, l2StartX, l2StartY, l2EndX, l2EndY, zgColor)
  creates trendline pairs
  Parameters:
    l1StartX (int): startX of first line
    l1StartY (float): startY of first line
    l1EndX (int): endX of first line
    l1EndY (float): endY of first line
    l2StartX (int): startX of second line
    l2StartY (float): startY of second line
    l2EndX (int): endX of second line
    l2EndY (float): endY of second line
    zgColor (color): line color
  Returns:

find_type(l1t, l2t, channelThreshold)
  Finds type based on trendline pairs
  Parameters:
    l1t (line): line1
    l2t (line): line2
    channelThreshold (simple float): theshold for channel identification
  Returns: pattern type and flags

getFlags(flags)
  Flatten flags
  Parameters:
    flags (bool): array of flags
  Returns: - flattened flags isChannel, isTriangle, isWedge, isExpanding, isContracting, isFlat, isRising, isFalling

getType(typeNum)
  Get type based on type number
  Parameters:
    typeNum (int): number representing type
  Returns: String value of type

getStatus(status, maxStatus)
  Get status based on integer value representations
  Parameters:
    status (int): integer representing current status
    maxStatus (int): integer representing max status
  Returns: String status value

calculate_simple_targets(trendLines, settingsMatrix, patternTypeMapping, patternType)
  Calculate targets based on trend lines
  Parameters:
    trendLines (line): trendline pair array
    settingsMatrix (matrix<float>): matrix containing settings
    patternTypeMapping (string): array containing pattern type mapping
    patternType (int): pattern type
  Returns: arrays containing long and short calculated targets

recalculate_position(patternTypeAndStatusMatrix, targetMatrix, index, pIndex, status, maxStatus, targetValue, stopValue, dir, breakevenOnTarget1)
  Recalculate position values
  Parameters:
    patternTypeAndStatusMatrix (matrix<int>): matrix containing pattern type and status
    targetMatrix (matrix<float>): matrix containing targets
    index (int): current index
    pIndex (int): pattern index
    status (int): current status
    maxStatus (int): max status reached
    targetValue (float): current target value
    stopValue (float): current stop value
    dir (int): direction
    breakevenOnTarget1 (simple bool): flag to breakeven upon target1
  Returns: new status and maxStatus values

draw_targets(longTargets, shortTargets, index, labelColor, patternName, positionIndex, longMaxStatus, longStatus, shortMaxStatus, shortStatus, tempBoxes, tempLines, tempLabels)
  Draw targets on chart
  Parameters:
    longTargets (matrix<float>): matrix containing long targets
    shortTargets (matrix<float>): matrix containing short targets
    index (int): current index
    labelColor (color): color of lines and labels
    patternName (string): Pattern name
    positionIndex (int): position on the chart
    longMaxStatus (int): max status for long
    longStatus (int): long status value
    shortMaxStatus (int): max status for short
    shortStatus (int): short status value
    tempBoxes (box): temporary box array
    tempLines (line): temporary lines array
    tempLabels (label): temporary labels array
  Returns: void

populate_open_stats(patternIdArray, barMatrix, patternTypeAndStatusMatrix, patternColorArray, longTargets, shortTargets, patternRRMatrix, OpenStatPosition, lblSizeOpenTrades)
  Populate open stats table
  Parameters:
    patternIdArray (int): pattern Ids
    barMatrix (matrix<int>): matrix containing bars
    patternTypeAndStatusMatrix (matrix<int>): matrix containing pattern type and status
    patternColorArray (color): array containing current patter colors
    longTargets (matrix<float>): matrix of long targets
    shortTargets (matrix<float>): matrix of short targets
    patternRRMatrix (matrix<float>): pattern risk reward matrix
    OpenStatPosition (simple string): table position
    lblSizeOpenTrades (simple string): text size
  Returns: void

draw_pattern_label(trendLines, patternFlagMatrix, patternTypeAndStatusMatrix, patternColorArray, patternFlags, patternLabelArray, zgColor, patternType, drawLabel, clearOldPatterns, safeRepaint, maxPatternsReference)
  Parameters:
    trendLines (line)
    patternFlagMatrix (matrix<bool>)
    patternTypeAndStatusMatrix (matrix<int>)
    patternColorArray (color)
    patternFlags (bool)
    patternLabelArray (label)
    zgColor (color)
    patternType (int)
    drawLabel (simple bool)
    clearOldPatterns (simple bool)
    safeRepaint (simple bool)
    maxPatternsReference (simple int)

populate_closed_stats(patternTypeAndStatusMatrix, bullishCounts, bearishCounts, bullishRetouchCounts, bearishRetouchCounts, bullishSizeMatrix, bearishSizeMatrix, bullishRR, bearishRR, ClosedStatsPosition, lblSizeClosedTrades, showSelectivePatternStats, showPatternStats, showStatsInPercentage)
  Parameters:
    patternTypeAndStatusMatrix (matrix<int>)
    bullishCounts (matrix<int>)
    bearishCounts (matrix<int>)
    bullishRetouchCounts (matrix<int>)
    bearishRetouchCounts (matrix<int>)
    bullishSizeMatrix (matrix<int>)
    bearishSizeMatrix (matrix<int>)
    bullishRR (matrix<float>)
    bearishRR (matrix<float>)
    ClosedStatsPosition (simple string)
    lblSizeClosedTrades (simple string)
    showSelectivePatternStats (simple bool)
    showPatternStats (simple bool)
    showStatsInPercentage (simple bool)

Perpustakaan Pine

Di dalam semangat sebenar TradingView, pengarang telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka, jadi pengaturcara-pengaturcara Pine yang lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara peribadi atau pada penerbitan-penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini di dalam penerbitan adalah ditadbir oleh Peraturan Dalaman.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Mahu gunakan perpustakaan ini?

Salin garisan ini dan tampalkan ia di dalam skrip anda.