Library

Personal library that is used in indicators created by traderrick86.
Added:
isUpBar()
isUpBar
Returns: Boolean: true if the current bar is up
isDownBar()
isDownBar
Returns: Boolean: true if the current bar is down
lowestOfOpenClose()
lowestOfOpenClose
Returns: float: the lower value between the bar's open and close prices
highestOfOpenClose()
highestOfOpenClose
Returns: float: the higher value between the bar's open and close prices
barRange()
barRange
Returns: float: the range of the bar calculated as the difference between high and low
Removed:
fun(x)
TODO: add function description here
Added:
avgBarRange(period)
avgBarRange
Parameters:
period (int): int: Number of bars to use for calculating the simple moving average of the bar range.
Returns: float: The average bar range, computed as ta.sma(barRange(), period)[1].
Added:
upBar()
upBar
Returns: Boolean: true if the current bar is up
downBar()
downBar
Returns: Boolean: true if the current bar is down
smallBarRange(avgBarRange, factor)
smallBarRange
Parameters:
avgBarRange (float): float: The average bar range.
factor (float): float: The multiplier factor for a small bar.
Returns: float: The computed small bar range.
bigBarRange(avgBarRange, factor)
bigBarRange
Parameters:
avgBarRange (float): float: The average bar range.
factor (float): float: The multiplier factor for a big bar.
Returns: float: The computed big bar range.
smallBar(barRange, smallBarRange)
notSmallBar
Parameters:
barRange (float): float: The current bar range, computed using barRange()
smallBarRange (float): float: The computed small bar range value
Returns: bool: true if the bar range is greater than the small bar range
bigBar(barRange, bigBarRange)
bigBar
Parameters:
barRange (float): float: The current bar range, computed using barRange()
bigBarRange (float): float: The computed big bar range value
Returns: bool: true if the bar range is greater than or equal to the big bar range
Removed:
isUpBar()
isUpBar
isDownBar()
isDownBar
Added:
notSmallBar(barRange, smallBarRange)
notSmallBar
Parameters:
barRange (float): float: The current bar range, computed using barRange()
smallBarRange (float): float: The computed small bar range value
Returns: bool: true if the bar range is greater than the small bar range
Removed:
smallBar(barRange, smallBarRange)
notSmallBar
Added:
movingAverage(src, length, smooth, maType)
movingAverage
Parameters:
src (float): series float: The source series (for example, close)
length (simple int): int: The number of bars for the moving average calculation
smooth (int): int: The smoothing factor (set to 0 to disable smoothing)
maType (string): string: The type of moving average ("sma" or "ema")
Returns: series float: The computed moving average based on the selected options
Updated:
movingAverage(src, length, smooth, maType)
movingAverage
Parameters:
src (float): series float: The source series (e.g., close)
length (simple int): int: The number of bars for the moving average calculation
smooth (int): int: The smoothing factor (0 to disable smoothing)
maType (string): string: The type of moving average ("sma" or "ema")
Returns: series float: The computed moving average with optional smoothing
Added:
nearMAs(src, pullbackNearMaInput, avgBarRange, maLength, maSmooth, maType)
nearMAs
Parameters:
src (float): series float: The source series (e.g., close)
pullbackNearMaInput (float): float: The factor to multiply with the average bar range to calculate the offset.
avgBarRange (float): float: The average bar range value.
maLength (simple int): int: The number of bars for the moving average calculation.
maSmooth (int): int: The smoothing factor (0 disables smoothing).
maType (string): string: The type of moving average ("sma" or "ema").
Returns: tuple: A tuple containing nearMaUpper and nearMaLower.
Removed:
nearMAs(src, pullbackNearMaInput, avgBarRange, maLength, maSmooth, maType)
nearMAs
Added:
isBarSize(barRange, avgBarRange, factor, operator)
isBarSize
Parameters:
barRange (float): float: The range of the current bar (high - low).
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma of bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use in the check.
Returns: bool: Returns true if the condition (barRange [operator] (avgBarRange * factor)) holds; otherwise, false.
Removed:
avgBarRange(period)
avgBarRange
smallBarRange(avgBarRange, factor)
smallBarRange
bigBarRange(avgBarRange, factor)
bigBarRange
notSmallBar(barRange, smallBarRange)
notSmallBar
bigBar(barRange, bigBarRange)
bigBar
Added:
validateBarRange(barRange, avgBarRange, factor, operator)
validateBarRange
Parameters:
barRange (float): float: The range of the current bar (high - low).
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma of bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use in the check.
Returns: bool: Returns true if the condition (barRange [operator] (avgBarRange * factor)) holds; otherwise, false.
Removed:
isBarSize(barRange, avgBarRange, factor, operator)
isBarSize
Added:
percentAboveBelow(source, barRange, side)
percentAboveBelow
Parameters:
source (float): float: The reference level (e.g., a moving average) to compare against.
barRange (float): float: The range of the current bar (typically high - low) used to normalize the percentage.
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source,
or "below" to compare the bar's low against the source.
Returns: float: If the condition is met, returns the percentage difference between the bar's high (or low) and the source,
expressed as a percentage of the bar's range; otherwise returns na.
Added:
percentOnSide(source, barRange, side)
percentOnSide
Parameters:
source (float): float: The reference level (e.g., a moving average) to compare against.
barRange (float): float: The range of the current bar (typically high - low) used to normalize the percentage.
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source,
or "below" to compare the bar's low against the source.
Returns: float: If the condition is met, returns the percentage difference between the bar's high (or low) and the source,
expressed as a percentage of the bar's range; otherwise returns na.
Removed:
percentAboveBelow(source, barRange, side)
percentAboveBelow
Added:
rangeBetweenBarAndSource(source)
rangeBetweenBarAndSource
Parameters:
source (float): float: The reference level (e.g., a moving average) against which the bar's position is evaluated.
Returns: float: If the bar's low is above the source, returns the difference (low - source); if the bar's high is below the source, returns the difference (source - high); otherwise, returns 0.
percentOnSideOfSource(barRange, side, source)
percentOnSideOfSource
Parameters:
barRange (float): float: The range of the current bar (typically high - low) used to normalize the percentage.
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source,
or "below" to compare the bar's low against the source.
source (float): float: The reference level (e.g., a moving average) to compare against.
Returns: float: If the condition is met, returns the percentage difference between the bar's high (or low) and the source,
expressed as a percentage of the bar's range; otherwise returns na.
Removed:
percentOnSide(source, barRange, side)
percentOnSide
Updated:
validateBarRange(barRange, operator, avgBarRange, factor)
validateBarRange
description checks if barRange=>operator=>avgBarRange*factor holds
Parameters:
barRange (float): float: The range of the current bar (high - low).
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use in the check.
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma of bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
Returns: bool: Returns true if the condition (barRange [operator] (avgBarRange * factor)) holds; otherwise, false.
percentOnSideOfSource(side, source)
percentOnSideOfSource
Parameters:
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source,
or "below" to compare the bar's low against the source.
source (float): float: The reference level (e.g., a moving average) to compare against.
Returns: float: If the condition is met, returns the percentage difference between the bar's high (or low) and the source,
expressed as a percentage of the bar's range; otherwise returns na.
Updated:
validateBarRange(avgBarRange, factor, operator)
validateBarRange
description Checks if the global variable 'barRange' satisfies a condition relative to a threshold,
where the threshold is computed as (avgBarRange * factor).
Parameters:
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma on bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use for the check.
Returns: bool: Returns true if the global barRange satisfies the condition (barRange [operator] (avgBarRange * factor)); otherwise, false.
rangeBetweenBarAndSource(source)
rangeBetweenBarAndSource
description Computes the difference between the bar's price extremes and a given reference level.
If the bar's low is above the source, it returns the difference (low - source).
If the bar's high is below the source, it returns the difference (source - high).
Otherwise, if the source lies within the bar, it returns 0.
Parameters:
source (float): float: The reference level (e.g., a moving average) against which the bar's position is evaluated.
Returns: float: The difference between the bar's extreme and the source when the bar is completely on one side of the source; otherwise, 0.
percentOnSideOfSource(side, source)
percentOnSideOfSource
description Calculates the percentage difference between the bar's high (if "above") or the bar's low (if "below")
and a specified reference level, normalized to the current bar's range. Returns na if the condition is not met.
Parameters:
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source,
or "below" to compare the bar's low against the source (case insensitive).
source (float): float: The reference level (e.g., a moving average) to compare against.
Returns: float: The percentage difference between the bar's high (or low) and the source, expressed as a percentage
of the bar's range; returns na if the condition is not satisfied.
Updated:
validateBarRange(avgBarRange, factor, operator)
validateBarRange
description: Checks if the global variable 'barRange' satisfies a condition relative to a threshold,
where the threshold is computed as (avgBarRange * factor).
Parameters:
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma on bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use for the check.
Returns: bool: Returns true if the global barRange satisfies the condition (barRange [operator] (avgBarRange * factor)); otherwise, false.
rangeBetweenBarAndSource(source)
rangeBetweenBarAndSource
description: Computes the difference between the bar's price extremes and a given reference level.
If the bar's low is above the source, it returns the difference (low - source).
If the bar's high is below the source, it returns the difference (source - high).
Otherwise, if the source lies within the bar, it returns 0.
Parameters:
source (float): float: The reference level (e.g., a moving average) against which the bar's position is evaluated.
Returns: float: The difference between the bar's extreme and the source when the bar is completely on one side of the source; otherwise, 0.
percentOnSideOfSource(side, source)
percentOnSideOfSource
description: Calculates the percentage difference between the bar's high (if "above") or the bar's low (if "below")
and a specified reference level, normalized to the current bar's range. Returns na if the condition is not met.
Parameters:
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source,
or "below" to compare the bar's low against the source (case insensitive).
source (float): float: The reference level (e.g., a moving average) to compare against.
Returns: float: The percentage difference between the bar's high (or low) and the source, expressed as a percentage
of the bar's range; returns na if the condition is not satisfied.
movingAverage(src, length, smooth, maType)
movingAverage
description: Computes a moving average for the provided source series using either SMA or EMA,
and optionally applies an additional smoothing step. When smooth is set to 0, no extra
smoothing is applied.
Parameters:
src (float): series float: The source series (e.g., close).
length (simple int): int: The number of bars to use for the initial moving average calculation.
smooth (int): int: The smoothing factor (set to 0 to disable smoothing).
maType (string): string: The type of moving average to compute ("sma" or "ema").
Returns: series float: The final computed moving average, optionally smoothed.
Updated:
validateBarRange(avgBarRange, factor, operator)
validateBarRange: Checks if the global variable 'barRange' satisfies a condition relative to a threshold,
where the threshold is computed as (avgBarRange * factor).
Parameters:
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma on bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use for the check.
Returns: bool: Returns true if the global barRange satisfies the condition (barRange [operator] (avgBarRange * factor)); otherwise, false.
rangeBetweenBarAndSource(source)
rangeBetweenBarAndSource: Computes the difference between the bar's price extremes and a given reference level.
If the bar's low is above the source, it returns the difference (low - source).
If the bar's high is below the source, it returns the difference (source - high).
Otherwise, if the source lies within the bar, it returns 0.
Parameters:
source (float): float: The reference level (e.g., a moving average) against which the bar's position is evaluated.
Returns: float: The difference between the bar's extreme and the source when the bar is completely on one side of the source; otherwise, 0.
percentOnSideOfSource(side, source)
percentOnSideOfSource: Calculates the percentage difference between the bar's high (if "above") or the bar's low (if "below")
and a specified reference level, normalized to the current bar's range. Returns na if the condition is not met.
Parameters:
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source,
or "below" to compare the bar's low against the source (case insensitive).
source (float): float: The reference level (e.g., a moving average) to compare against.
Returns: float: The percentage difference between the bar's high (or low) and the source, expressed as a percentage
of the bar's range; returns na if the condition is not satisfied.
movingAverage(src, length, smooth, maType)
movingAverage: Computes a moving average for the provided source series using either SMA or EMA,
and optionally applies an additional smoothing step. When smooth is set to 0, no extra
smoothing is applied.
Parameters:
src (float): series float: The source series (e.g., close).
length (simple int): int: The number of bars to use for the initial moving average calculation.
smooth (int): int: The smoothing factor (set to 0 to disable smoothing).
maType (string): string: The type of moving average to compute ("sma" or "ema").
Returns: series float: The final computed moving average, optionally smoothed.
Updated:
validateBarRange(avgBarRange, factor, operator)
validateBarRange: Checks if the global variable 'barRange' satisfies a condition relative to a threshold, where the threshold is computed as (avgBarRange * factor).
Parameters:
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma on bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use for the check.
Returns: bool: Returns true if the global barRange satisfies the condition (barRange [operator] (avgBarRange * factor)); otherwise, false.
rangeBetweenBarAndSource(source)
rangeBetweenBarAndSource: Computes the difference between the bar's price extremes and a given reference level. If the bar's low is above the source, it returns the difference (low - source). If the bar's high is below the source, it returns the difference (source - high). Otherwise, if the source lies within the bar, it returns 0.
Parameters:
source (float): float: The reference level (e.g., a moving average) against which the bar's position is evaluated.
Returns: float: The difference between the bar's extreme and the source when the bar is completely on one side of the source; otherwise, 0.
percentOnSideOfSource(side, source)
percentOnSideOfSource: Calculates the percentage difference between the bar's high (if "above") or the bar's low (if "below") and a specified reference level, normalized to the current bar's range. Returns na if the condition is not met.
Parameters:
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source,
or "below" to compare the bar's low against the source (case insensitive).
source (float): float: The reference level (e.g., a moving average) to compare against.
Returns: float: The percentage difference between the bar's high (or low) and the source, expressed as a percentage
of the bar's range; returns na if the condition is not satisfied.
movingAverage(src, length, smooth, maType)
movingAverage: Computes a moving average for the provided source series using either SMA or EMA, and optionally applies an additional smoothing step. When smooth is set to 0, no extra smoothing is applied.
Parameters:
src (float): series float: The source series (e.g., close).
length (simple int): int: The number of bars to use for the initial moving average calculation.
smooth (int): int: The smoothing factor (set to 0 to disable smoothing).
maType (string): string: The type of moving average to compute ("sma" or "ema").
Returns: series float: The final computed moving average, optionally smoothed.
Updated:
validateBarRange(avgBarRange, factor, operator)
validateBarRange
Parameters:
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma on bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use for the check.
Returns: bool: Returns true if the global barRange satisfies the condition (barRange [operator] (avgBarRange * factor)); otherwise, false.
rangeBetweenBarAndSource(source)
rangeBetweenBarAndSource
Parameters:
source (float): float: The reference level (e.g., a moving average) against which the bar's position is evaluated.
Returns: float: The difference between the bar's extreme and the source when the bar is completely on one side of the source; otherwise, 0.
percentOnSideOfSource(side, source)
percentOnSideOfSource
Parameters:
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source,
or "below" to compare the bar's low against the source (case insensitive).
source (float): float: The reference level (e.g., a moving average) to compare against.
Returns: float: The percentage difference between the bar's high (or low) and the source, expressed as a percentage
of the bar's range; returns na if the condition is not satisfied.
movingAverage(src, length, smooth, maType)
movingAverage
Parameters:
src (float): series float: The source series (e.g., close).
length (simple int): int: The number of bars to use for the initial moving average calculation.
smooth (int): int: The smoothing factor (set to 0 to disable smoothing).
maType (string): string: The type of moving average to compute ("sma" or "ema").
Returns: series float: The final computed moving average, optionally smoothed.
Updated:
validateBarRange(avgBarRange, factor, operator)
validateBarRange: Checks if the global variable 'barRange' satisfies a condition relative to a threshold,
where the threshold is computed as (avgBarRange * factor).
Parameters:
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma on bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use for the check.
Returns: bool: Returns true if the global barRange satisfies the condition (barRange [operator] (avgBarRange * factor)); otherwise, false.
rangeBetweenBarAndSource(source)
rangeBetweenBarAndSource: Computes the difference between the bar's price extremes and a given reference level.
If the bar's low is above the source, it returns the difference (low - source).
If the bar's high is below the source, it returns the difference (source - high).
Otherwise, if the source lies within the bar, it returns 0.
Parameters:
source (float): float: The reference level (e.g., a moving average) against which the bar's position is evaluated.
Returns: float: The difference between the bar's extreme and the source when the bar is completely on one side of the source; otherwise, 0.
percentOnSideOfSource(side, source)
percentOnSideOfSource: Calculates the percentage difference between the bar's high (if "above") or the bar's low (if "below")
and a specified reference level, normalized to the current bar's range. Returns na if the condition is not met.
Parameters:
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source,
or "below" to compare the bar's low against the source (case insensitive).
source (float): float: The reference level (e.g., a moving average) to compare against.
Returns: float: The percentage difference between the bar's high (or low) and the source, expressed as a percentage
of the bar's range; returns na if the condition is not satisfied.
movingAverage(src, length, smooth, maType)
movingAverage: Computes a moving average for the provided source series using either SMA or EMA,
and optionally applies an additional smoothing step. When smooth is set to 0, no extra
smoothing is applied.
Parameters:
src (float): series float: The source series (e.g., close).
length (simple int): int: The number of bars to use for the initial moving average calculation.
smooth (int): int: The smoothing factor (set to 0 to disable smoothing).
maType (string): string: The type of moving average to compute ("sma" or "ema").
Returns: series float: The final computed moving average, optionally smoothed.
Added:
neutralBar()
neutralBar
Returns: Boolean: true if the current bar is down.
upperTailPercent()
upperTailPercent
Returns: float: The upper tail percentage relative to the global barRange.
lowerTailPercent()
lowerTailPercent
Returns: float: The lower tail percentage relative to the global barRange.
totalTailPercent()
totalTailPercent
Returns: float: The total tail percentage relative to the global barRange.
bodyPercent()
bodyPercent
Returns: float: The body percentage relative to the global barRange.
validateCondition(value, operator, threshold)
validateCondition
description: Compares a value against a threshold using the provided operator (case-insensitive).
Parameters:
value (float): float: The value to compare.
operator (string): string: The comparison operator ("<", "<=", ">", ">=", "==").
threshold (float): float: The threshold to compare against.
Returns: bool: Returns true if the condition holds; otherwise, false.
validateTailsAndBodyPercent(lowerTailPercentThreshold, lowerTailOperator, upperTailPercentThreshold, upperTailOperator, bodyPercentThreshold, bodyOperator)
validateTailsAndBodyPercent: Validates the bar's tail and body percentages (relative to the global barRange) by
comparing the lower tail, upper tail, and body percentages against user-specified thresholds
using provided operators. For neutral bars (doji), only the tail percentages are evaluated.
Parameters:
lowerTailPercentThreshold (float): float: The threshold for the lower tail percentage.
lowerTailOperator (string): string: The operator ("<", "<=", ">", ">=", "==") for the lower tail percentage condition.
upperTailPercentThreshold (float): float: The threshold for the upper tail percentage.
upperTailOperator (string): string: The operator ("<", "<=", ">", ">=", "==") for the upper tail percentage condition.
bodyPercentThreshold (float): float: The threshold for the body percentage.
bodyOperator (string): string: The operator ("<", "<=", ">", ">=", "==") for the body percentage condition.
Returns: bool: Returns true if all applicable conditions are met; otherwise, false.
Updated:
upBar()
upBar
Returns: Boolean: true if the current bar is up.
downBar()
downBar
Returns: Boolean: true if the current bar is down.
lowestOfOpenClose()
lowestOfOpenClose
Returns: float: the lower value between the bar's open and close prices.
highestOfOpenClose()
highestOfOpenClose
Returns: float: the higher value between the bar's open and close prices.
barRange()
barRange
Returns: float: the range of the bar calculated as the difference between high and low.
validateBarRange(avgBarRange, factor, operator)
validateBarRange: Checks if the global variable 'barRange' satisfies a condition relative to a threshold,
where the threshold is computed as (avgBarRange * factor). Used to check if the bar is
or is not of a certain size, for example to calculate a 'big bar' or 'small bar'.
Parameters:
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma on bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use for the check.
Returns: bool: Returns true if the global barRange satisfies the condition (barRange [operator] (avgBarRange * factor)); otherwise, false.
Added:
upperTailRange()
upperTailRange
Returns: float: The upper tail range of the current bar.
Calculates the upper tail as follows:
• For bullish bars (upBar): high - close
• For bearish bars (downBar): high - open
• For neutral bars (doji): high - close
lowerTailRange()
lowerTailRange
Returns: float: The lower tail range of the current bar.
Calculates the lower tail as follows:
• For bullish bars (upBar): open - low
• For bearish bars (downBar): close - low
• For neutral bars (doji): close - low
totalTailRange()
totalTailRange
Returns: float: The total tail range of the current bar, computed as the sum of the upper and lower tail ranges.
bodyRange()
bodyRange
Returns: float: The body range of the current bar, computed as the total bar range minus the total tail range.
Updated:
validateBarRange(avgBarRange, factor, operator)
validateBarRange: Checks if the global variable 'barRange' satisfies a condition relative to a threshold,
where the threshold is computed as (avgBarRange * factor). Used to determine if the bar
is of a certain size (e.g., a 'big bar' or 'small bar').
Parameters:
avgBarRange (float): float: The average bar range (e.g., computed by ta.sma on bar ranges).
factor (float): float: The multiplier applied to avgBarRange to determine the threshold for bar size.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") to use for the check.
Returns: bool: Returns true if the global barRange satisfies the condition (barRange [operator] (avgBarRange * factor)); otherwise, false.
Removed:
validateTailsAndBodyPercent(lowerTailPercentThreshold, lowerTailOperator, upperTailPercentThreshold, upperTailOperator, bodyPercentThreshold, bodyOperator)
validateTailsAndBodyPercent: Validates the bar's tail and body percentages (relative to the global barRange) by
comparing the lower tail, upper tail, and body percentages against user-specified thresholds
using provided operators. For neutral bars (doji), only the tail percentages are evaluated.
Added:
validateMeasure(measure, avgValue, factor, operator)
validateMeasure
Parameters:
measure (float): float: The measure to validate (e.g., barRange or bodyRange).
avgValue (float): float: The average value used in the threshold calculation.
factor (float): float: The multiplier applied to avgValue to compute the threshold.
operator (string): string: The comparison operator ("<", "<=", ">", ">=") for the check.
Returns: bool: Returns true if measure satisfies the condition (measure [operator] (avgValue * factor)); otherwise, false.
Removed:
validateBarRange(avgBarRange, factor, operator)
validateBarRange: Checks if the global variable 'barRange' satisfies a condition relative to a threshold,
where the threshold is computed as (avgBarRange * factor). Used to determine if the bar
is of a certain size (e.g., a 'big bar' or 'small bar').
Added:
percentRangeOnSideOfSource(side, source)
percentRangeOnSideOfSource: Calculates the percentage difference between the bar's extreme (high if "above" or low if "below")
and a specified reference level, normalized to the bar's range. Returns na if the condition is not satisfied.
Parameters:
side (string): string: Specifies which side to check. Use "above" to compare the bar's high against the source, or "below" to compare
the bar's low against the source (case insensitive).
source (float): float: The reference level (e.g., a moving average) to compare against.
Returns: float: The percentage difference between the bar's extreme (high or low) and the source, expressed as a percentage of the
bar's range; returns na if the condition is not met.
percentBodyOnSideOfSource(side, source)
percentBodyOnSideOfSource: Calculates the percentage difference between the bar's body boundary and a specified reference level,
normalized to the bar's body range. For "above", it returns the percentage difference between the lower boundary of the body (min(open,close))
and the source, provided the entire body is above the source. For "below", it returns the percentage difference between the source and the
upper boundary of the body (max(open,close)), provided the entire body is below the source. Returns na if the condition is not met.
Parameters:
side (string): string: Specifies which side to check. Use "above" to compare the bar's body against the source, or "below" to compare it against the source (case insensitive).
source (float): float: The reference level (e.g., a moving average) to compare against.
Returns: float: The percentage difference between the relevant body boundary and the source, expressed as a percentage of the bar's bodyRange; returns na if the condition is not satisfied.
Removed:
percentOnSideOfSource(side, source)
percentOnSideOfSource: Calculates the percentage difference between the bar's high (if "above") or the bar's low (if "below")
and a specified reference level, normalized to the current bar's range. Returns na if the condition is not met.
Updated:
percentRangeOnSideOfSource(side, source)
percentRangeOnSideOfSource: Calculates the percentage difference between the bar's extreme (the high for "above" or the low for "below")
and a specified reference level, normalized to the bar's overall range. Returns na if the condition is not met.
Parameters:
side (string): string: Specifies which extreme to compare—use "above" to compare the bar's high to the reference, or "below" to compare the bar's low to the reference (case insensitive).
source (float): float: The reference level (e.g., a moving average) against which the bar's extreme is compared.
Returns: float: The percentage difference between the chosen bar extreme and the reference, expressed as a percentage of the bar's range; returns na if the condition is not satisfied.
percentBodyOnSideOfSource(side, source)
percentBodyOnSideOfSource: Calculates the percentage difference between the relevant boundary of the bar's body
and a specified reference level, normalized to the bar's body range. For "above", it compares the upper boundary of the body
(highestOfOpenClose) to the reference; for "below", it compares the lower boundary of the body (lowestOfOpenClose) to the reference.
Returns na if the condition is not met.
Parameters:
side (string): string: Specifies which boundary of the body to compare—use "above" to compare the upper boundary to the reference,
or "below" to compare the lower boundary to the reference (case insensitive).
source (float): float: The reference level (e.g., a moving average) against which the body's boundary is compared.
Returns: float: The percentage difference between the chosen body boundary and the reference, expressed as a percentage of the bar's body range; returns na if the condition is not satisfied.
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.
Haftungsausschluss
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.