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:
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:
histProfile(source) Histogram profiling
Parameters:
source: Histogram series
Returns:
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:
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:
histProfile(source) Histogram profiling
Parameters:
source: Histogram series
Returns:
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.
Notas de prensa:
v2
Updated:
histProfile(hist, ref) Histogram profiling
Parameters:
hist: Histogram series
ref: Reference value. By default '0'
Returns:
Updated:
histProfile(hist, ref) Histogram profiling
Parameters:
hist: Histogram series
ref: Reference value. By default '0'
Returns:
Notas de prensa:
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.
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.
Notas de prensa:
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.
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.
Notas de prensa:
v5
Updated:
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:
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:
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.
Updated:
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:
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:
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.
I develop indicators meant to be useful, profitable and good looking.