Update BB volume protection
This commit is contained in:
@@ -34,29 +34,30 @@ public class BollingerBandsVolatilityProtection : BollingerBandsBase
|
|||||||
// Determine confidence based on width levels (bandwidth as % of SMA)
|
// Determine confidence based on width levels (bandwidth as % of SMA)
|
||||||
// Lower width = less volatility = higher confidence for trading
|
// Lower width = less volatility = higher confidence for trading
|
||||||
// Higher width = more volatility = lower confidence for trading
|
// Higher width = more volatility = lower confidence for trading
|
||||||
|
// Typical BB bandwidth values: 0.01-0.08 for most markets
|
||||||
Confidence confidence;
|
Confidence confidence;
|
||||||
|
|
||||||
if (width >= 0.15) // Extremely high volatility - dangerous expansion
|
if (width >= 0.06) // High volatility - dangerous expansion (6%+)
|
||||||
{
|
{
|
||||||
// Block all signals during dangerous volatility expansion
|
// Block all signals during dangerous volatility expansion
|
||||||
confidence = Confidence.None;
|
confidence = Confidence.None;
|
||||||
}
|
}
|
||||||
else if (width <= 0.02) // Extremely low volatility - dead market/squeeze
|
else if (width <= 0.01) // Extremely low volatility - dead market/squeeze (1% or less)
|
||||||
{
|
{
|
||||||
// Block all signals in dead markets or extreme squeezes
|
// Block all signals in dead markets or extreme squeezes
|
||||||
confidence = Confidence.None;
|
confidence = Confidence.None;
|
||||||
}
|
}
|
||||||
else if (width <= 0.05) // Low to normal volatility - good for trading
|
else if (width <= 0.025) // High confidence - optimal for trading (1% - 2.5%)
|
||||||
{
|
{
|
||||||
// Validate signals during low volatility trending conditions
|
// Validate signals during low volatility trending conditions
|
||||||
confidence = Confidence.High;
|
confidence = Confidence.High;
|
||||||
}
|
}
|
||||||
else if (width <= 0.10) // Normal volatility - acceptable for trading
|
else if (width <= 0.035) // Medium confidence - acceptable for trading (2.5% - 3.5%)
|
||||||
{
|
{
|
||||||
// Validate signals during normal volatility conditions
|
// Validate signals during normal volatility conditions
|
||||||
confidence = Confidence.Medium;
|
confidence = Confidence.Medium;
|
||||||
}
|
}
|
||||||
else // Moderate high volatility (0.10 - 0.15)
|
else // Moderate high volatility (3.5% - 6%)
|
||||||
{
|
{
|
||||||
// Lower confidence during elevated but not extreme volatility
|
// Lower confidence during elevated but not extreme volatility
|
||||||
confidence = Confidence.Low;
|
confidence = Confidence.Low;
|
||||||
|
|||||||
@@ -658,13 +658,13 @@ const TradeChart = ({
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
volatilityWidthSeries.setData(volatilityWidthData)
|
volatilityWidthSeries.setData(volatilityWidthData)
|
||||||
|
|
||||||
// Add confidence range lines (0.02 - 0.10)
|
// Add confidence range lines with clear range indicators
|
||||||
const confidenceMinLine = chart.current.addLineSeries({
|
const highConfidenceMinLine = chart.current.addLineSeries({
|
||||||
color: '#16A34A', // Green for confidence range minimum
|
color: '#16A34A', // Green for high confidence zone
|
||||||
lineWidth: 1,
|
lineWidth: 1,
|
||||||
priceLineVisible: true,
|
priceLineVisible: true,
|
||||||
priceLineWidth: 1,
|
priceLineWidth: 1,
|
||||||
title: 'Conf Min (2%)',
|
title: 'High: 1% → 2.5%',
|
||||||
pane: paneCount,
|
pane: paneCount,
|
||||||
lineStyle: LineStyle.Dashed,
|
lineStyle: LineStyle.Dashed,
|
||||||
priceFormat: {
|
priceFormat: {
|
||||||
@@ -674,12 +674,27 @@ const TradeChart = ({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const highMediumThresholdLine = chart.current.addLineSeries({
|
||||||
|
color: '#CA8A04', // Yellow/Amber to separate High from Medium confidence
|
||||||
|
lineWidth: 1,
|
||||||
|
priceLineVisible: true,
|
||||||
|
priceLineWidth: 1,
|
||||||
|
title: 'Medium: 2.5% → 3.5%',
|
||||||
|
pane: paneCount,
|
||||||
|
lineStyle: LineStyle.Dotted,
|
||||||
|
priceFormat: {
|
||||||
|
minMove: 0.001,
|
||||||
|
precision: 3,
|
||||||
|
type: 'price',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const confidenceMaxLine = chart.current.addLineSeries({
|
const confidenceMaxLine = chart.current.addLineSeries({
|
||||||
color: '#16A34A', // Green for confidence range maximum
|
color: '#16A34A', // Green for confidence range maximum
|
||||||
lineWidth: 1,
|
lineWidth: 1,
|
||||||
priceLineVisible: true,
|
priceLineVisible: true,
|
||||||
priceLineWidth: 1,
|
priceLineWidth: 1,
|
||||||
title: 'Conf Max (10%)',
|
title: 'Max: 3.5%',
|
||||||
pane: paneCount,
|
pane: paneCount,
|
||||||
lineStyle: LineStyle.Dashed,
|
lineStyle: LineStyle.Dashed,
|
||||||
priceFormat: {
|
priceFormat: {
|
||||||
@@ -689,30 +704,45 @@ const TradeChart = ({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create horizontal lines for confidence range
|
// Create horizontal lines for confidence zones
|
||||||
|
// High confidence: 1% - 2.5%
|
||||||
|
// Medium confidence: 2.5% - 3.5%
|
||||||
const bollingerBands = indicatorsValues.BollingerBandsVolatilityProtection.bollingerBands
|
const bollingerBands = indicatorsValues.BollingerBandsVolatilityProtection.bollingerBands
|
||||||
if (bollingerBands && bollingerBands.length > 0) {
|
if (bollingerBands && bollingerBands.length > 0) {
|
||||||
const confidenceMinData = [
|
const highConfidenceMinData = [
|
||||||
{
|
{
|
||||||
time: moment(bollingerBands[0].date).unix(),
|
time: moment(bollingerBands[0].date).unix(),
|
||||||
value: 0.02, // Confidence minimum threshold
|
value: 0.01, // High confidence minimum threshold (1%)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
time: moment(bollingerBands[bollingerBands.length - 1].date).unix(),
|
time: moment(bollingerBands[bollingerBands.length - 1].date).unix(),
|
||||||
value: 0.02, // Confidence minimum threshold
|
value: 0.01, // High confidence minimum threshold (1%)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
confidenceMinLine.setData(confidenceMinData)
|
highConfidenceMinLine.setData(highConfidenceMinData)
|
||||||
|
|
||||||
|
const highMediumThresholdData = [
|
||||||
|
{
|
||||||
|
time: moment(bollingerBands[0].date).unix(),
|
||||||
|
value: 0.025, // High/Medium confidence threshold (2.5%)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: moment(bollingerBands[bollingerBands.length - 1].date).unix(),
|
||||||
|
value: 0.025, // High/Medium confidence threshold (2.5%)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
// @ts-ignore
|
||||||
|
highMediumThresholdLine.setData(highMediumThresholdData)
|
||||||
|
|
||||||
const confidenceMaxData = [
|
const confidenceMaxData = [
|
||||||
{
|
{
|
||||||
time: moment(bollingerBands[0].date).unix(),
|
time: moment(bollingerBands[0].date).unix(),
|
||||||
value: 0.10, // Confidence maximum threshold
|
value: 0.035, // Confidence maximum threshold (3.5%)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
time: moment(bollingerBands[bollingerBands.length - 1].date).unix(),
|
time: moment(bollingerBands[bollingerBands.length - 1].date).unix(),
|
||||||
value: 0.10, // Confidence maximum threshold
|
value: 0.035, // Confidence maximum threshold (3.5%)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|||||||
Reference in New Issue
Block a user