PINE LIBRARY
已更新 Common Functions

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.
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.
發行說明
v2Updated:
histProfile(hist, ref) Histogram profiling
Parameters:
hist: Histogram series
ref: Reference value. By default '0'
Returns: [histPosUp, histPosDown, histNegUp, histNegDown]
發行說明
v3Added:
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.
發行說明
v4Added:
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.
發行說明
v5Updated:
crosses(source1, offset1, source2, offset2)
Checks the existance of crosses between the series
Parameters:
source1 (float): First series
offset1 (int): (Optional) Offset of First series. By default 0
source2 (float): (Optional) Second series. By default 'close' price
offset2 (int): (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 (float): Active used to determine bullish/bearish states.
offset1 (int): (Optional) Offset of First series. By default 0.
source2 (float): (Optional) Second series. By default 'close' price.
offset2 (int): (Optional) Offset of Second series. By default 0.
Returns: [bullish, bearish]
floatSelect(showSrc1, src1, showSrc2, src2, showSrc3, src3, showSrc4, src4, showSrc5, src5, showSrc6, src6, showSrc7, src7, showSrc8, src8, showSrc9, src9, showSrc10, src10)
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 (bool): Boolean controlling the activation of Source #1.
src1 (float): Source #1.
showSrc2 (bool): Boolean controlling the activation of Sources #2-10. By default 'false'.
src2 (float): Sources #2-10. By default 'number'.
showSrc3 (bool)
src3 (float)
showSrc4 (bool)
src4 (float)
showSrc5 (bool)
src5 (float)
showSrc6 (bool)
src6 (float)
showSrc7 (bool)
src7 (float)
showSrc8 (bool)
src8 (float)
showSrc9 (bool)
src9 (float)
showSrc10 (bool)
src10 (float)
Returns: Selected source.
intSelect(showSrc1, src1, showSrc2, src2, showSrc3, src3, showSrc4, src4, showSrc5, src5, showSrc6, src6, showSrc7, src7, showSrc8, src8, showSrc9, src9, showSrc10, src10)
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 (bool): Boolean controlling the activation of Source #1.
src1 (int): Source #1.
showSrc2 (bool): Boolean controlling the activation of Sources #2-10. By default 'false'.
src2 (int): Sources #2-10. By default 'number'.
showSrc3 (bool)
src3 (int)
showSrc4 (bool)
src4 (int)
showSrc5 (bool)
src5 (int)
showSrc6 (bool)
src6 (int)
showSrc7 (bool)
src7 (int)
showSrc8 (bool)
src8 (int)
showSrc9 (bool)
src9 (int)
showSrc10 (bool)
src10 (int)
Returns: Selected source.
boolSelect(showSrc1, src1, showSrc2, src2, showSrc3, src3, showSrc4, src4, showSrc5, src5, showSrc6, src6, showSrc7, src7, showSrc8, src8, showSrc9, src9, showSrc10, src10)
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 (bool): Boolean controlling the activation of Source #1.
src1 (bool): Source #1.
showSrc2 (bool): Boolean controlling the activation of Sources #2-10. By default 'false'.
src2 (bool): Sources #2-10. By default 'false'.
showSrc3 (bool)
src3 (bool)
showSrc4 (bool)
src4 (bool)
showSrc5 (bool)
src5 (bool)
showSrc6 (bool)
src6 (bool)
showSrc7 (bool)
src7 (bool)
showSrc8 (bool)
src8 (bool)
showSrc9 (bool)
src9 (bool)
showSrc10 (bool)
src10 (bool)
Returns: Selected source.
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 (bool): Boolean controlling the activation of Source #1.
src1 (color): Source #1.
showSrc2 (bool): Boolean controlling the activation of Sources #2-10. By default 'false'.
src2 (color): Sources #2-10. By default 'false'.
showSrc3 (bool)
src3 (color)
showSrc4 (bool)
src4 (color)
showSrc5 (bool)
src5 (color)
showSrc6 (bool)
src6 (color)
showSrc7 (bool)
src7 (color)
showSrc8 (bool)
src8 (color)
showSrc9 (bool)
src9 (color)
showSrc10 (bool)
src10 (color)
Returns: Selected source.
Pine腳本庫
秉持TradingView一貫精神,作者已將此Pine代碼以開源函式庫形式發佈,方便我們社群中的其他Pine程式設計師重複使用。向作者致敬!您可以在私人專案或其他開源發表中使用此函式庫,但在公開發表中重用此代碼須遵守社群規範。
I develop indicators meant to be useful, profitable and good looking.
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
Pine腳本庫
秉持TradingView一貫精神,作者已將此Pine代碼以開源函式庫形式發佈,方便我們社群中的其他Pine程式設計師重複使用。向作者致敬!您可以在私人專案或其他開源發表中使用此函式庫,但在公開發表中重用此代碼須遵守社群規範。
I develop indicators meant to be useful, profitable and good looking.
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。