TradingView
gliderfund
6 מרץ 2022 23:48

Common Functions 

Bitcoin / U.S. dollarBitstamp

תיאור

Library "CommonFunctions"
This Library provides some handy functions commonly used in Pine Script.

crosses(source1, offset1, source2, offset2) Checks the existance of crosses between the series
  Parameters:
    source1: First series
    offset1: (Optional) Offset of First series. By default 0
    source2: (Optional) Second series. By default 'close' price
    offset2: (Optional) Offset of Second series. By default 0
  Returns: [cross, crossOver, crossUnder]

marketState(source1, offset1, source2, offset2) Determines Bullish/Bearish state according to the relative position between the series.
  Parameters:
    source1: Active series used to determine bullish/bearish states.
    offset1: (Optional) Offset of First series. By default 0.
    source2: (Optional) Second series. By default 'close' price.
    offset2: (Optional) Offset of Second series. By default 0.
  Returns: [bullish, bearish]

histProfile(source) Histogram profiling
  Parameters:
    source: Histogram series
  Returns: [histPosUp, histPosDown, histNegUp, histNegDown]

srcSelect(showSrc1, src1, showSrc2, src2) Selects the appropiate source. If multiple sources are activated simultaneously, the order within the switch clause prevails. The first one activated is the one being output.
  Parameters:
    showSrc1: Boolean controlling the activation of Source #1.
    src1: Source #1.
    showSrc2: Boolean controlling the activation of Sources #2-10. By default 'false'.
    src2: Sources #2-10. By default 'number'.
  Returns: Selected source.

הערות שחרור

v2

Updated:
histProfile(hist, ref) Histogram profiling
  Parameters:
    hist: Histogram series
    ref: Reference value. By default '0'
  Returns: [histPosUp, histPosDown, histNegUp, histNegDown]

הערות שחרור

v3

Added:
floatSelect(showSrc1, src1, showSrc2, src2) Selects the appropiate float variable based on a boolean condition. If multiple sources are activated simultaneously, the order within the switch clause prevails. The first one activated is the one being output.
  Parameters:
    showSrc1: Boolean controlling the activation of Source #1.
    src1: Source #1.
    showSrc2: Boolean controlling the activation of Sources #2-10. By default 'false'.
    src2: Sources #2-10. By default 'number'.
  Returns: Selected source.

intSelect(showSrc1, src1, showSrc2, src2) Selects the appropiate integer variable based on a boolean condition. If multiple sources are activated simultaneously, the order within the switch clause prevails. The first one activated is the one being output.
  Parameters:
    showSrc1: Boolean controlling the activation of Source #1.
    src1: Source #1.
    showSrc2: Boolean controlling the activation of Sources #2-10. By default 'false'.
    src2: Sources #2-10. By default 'number'.
  Returns: Selected source.

boolSelect(showSrc1, src1, showSrc2, src2) Selects the appropiate bool variable based on a boolean condition. If multiple sources are activated simultaneously, the order within the switch clause prevails. The first one activated is the one being output.
  Parameters:
    showSrc1: Boolean controlling the activation of Source #1.
    src1: Source #1.
    showSrc2: Boolean controlling the activation of Sources #2-10. By default 'false'.
    src2: Sources #2-10. By default 'false'.
  Returns: Selected source.

Removed:
srcSelect(showSrc1, src1, showSrc2, src2) Selects the appropiate source based on a boolean variable. If multiple sources are activated simultaneously, the order within the switch clause prevails. The first one activated is the one being output.

הערות שחרור

v4

Added:
colorSelect(showSrc1, src1, showSrc2, src2, showSrc3, src3, showSrc4, src4, showSrc5, src5, showSrc6, src6, showSrc7, src7, showSrc8, src8, showSrc9, src9, showSrc10, src10)
  Selects the appropiate color variable based on a boolean condition. If multiple sources are activated simultaneously, the order within the switch clause prevails. The first one activated is the one being output.
  Parameters:
    showSrc1 (simple bool): Boolean controlling the activation of Source #1.
    src1 (color): Source #1.
    showSrc2 (simple bool): Boolean controlling the activation of Sources #2-10. By default 'false'.
    src2 (color): Sources #2-10. By default 'false'.
    showSrc3 (simple bool)
    src3 (color)
    showSrc4 (simple bool)
    src4 (color)
    showSrc5 (simple bool)
    src5 (color)
    showSrc6 (simple bool)
    src6 (color)
    showSrc7 (simple bool)
    src7 (color)
    showSrc8 (simple bool)
    src8 (color)
    showSrc9 (simple bool)
    src9 (color)
    showSrc10 (simple bool)
    src10 (color)
  Returns: Selected source.
עוד