PINE LIBRARY

cphelper

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: [line, line]

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: [int, array<bool>] pattern type and flags

getFlags(flags)
  Flatten flags
  Parameters:
    flags (bool[]): array of flags
  Returns: [boolean, boolean, boolean, boolean, boolean, boolean, boolean] - 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: [array<float>, array<float>] 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: [int, int] 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)
acpuhelperarraysformattinghewhomustnotbenamedMarket Geometrytrendoscope

ไลบรารีไพน์

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนได้เผยแพร่ Pine code นี้เป็นโอเพนซอร์ซไลบรารีเพื่อให้ Pine โปรแกรมเมอร์คนอื่นในชุมชนของเราสามารถนำไปใช้ซ้ำได้ ต้องขอบคุณผู้เขียน! คุณสามารถใช้ไลบรารีนี้ในแบบส่วนตัวหรือในการเผยแพร่แบบโอเพนซอร์สอื่น ๆ แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน

คำจำกัดสิทธิ์ความรับผิดชอบ