Fix graph
This commit is contained in:
@@ -66,9 +66,18 @@ const BacktestRowDetails: React.FC<IBacktestRowDetailsProps> = ({
|
||||
slowPeriods: indicator.slowPeriods,
|
||||
signalPeriods: indicator.signalPeriods,
|
||||
multiplier: indicator.multiplier,
|
||||
stDev: indicator.stDev,
|
||||
smoothPeriods: indicator.smoothPeriods,
|
||||
stochPeriods: indicator.stochPeriods,
|
||||
cyclePeriods: indicator.cyclePeriods
|
||||
cyclePeriods: indicator.cyclePeriods,
|
||||
kFactor: indicator.kFactor,
|
||||
dFactor: indicator.dFactor,
|
||||
tenkanPeriods: indicator.tenkanPeriods,
|
||||
kijunPeriods: indicator.kijunPeriods,
|
||||
senkouBPeriods: indicator.senkouBPeriods,
|
||||
offsetPeriods: indicator.offsetPeriods,
|
||||
senkouOffset: indicator.senkouOffset,
|
||||
chikouOffset: indicator.chikouOffset
|
||||
})) || [],
|
||||
loopbackPeriod: backtest.config.scenario.loopbackPeriod
|
||||
} : undefined
|
||||
@@ -76,7 +85,6 @@ const BacktestRowDetails: React.FC<IBacktestRowDetailsProps> = ({
|
||||
|
||||
return await dataClient.data_GetCandlesWithIndicators(request);
|
||||
},
|
||||
enabled: !backtest.candles || backtest.candles.length === 0, // Only run query if no candles exist
|
||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||
gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)
|
||||
});
|
||||
|
||||
@@ -565,47 +565,6 @@ const TradeChart = ({
|
||||
lowerBandSeries.setData(lowerBandData)
|
||||
}
|
||||
|
||||
// Display Bollinger Bands on price chart for Volatility Protection
|
||||
if (indicatorsValues?.BollingerBandsVolatilityProtection != null) {
|
||||
const upperBandSeries = chart.current.addLineSeries({
|
||||
color: '#FF6B6B', // Lighter red for volatility protection bands
|
||||
lineWidth: 1,
|
||||
priceLineVisible: false,
|
||||
priceLineWidth: 1,
|
||||
title: 'Volatility Protection Upper Band',
|
||||
pane: 0,
|
||||
lineStyle: LineStyle.Dotted,
|
||||
})
|
||||
|
||||
const upperBandData = indicatorsValues.BollingerBandsVolatilityProtection.bollingerBands?.map((w) => {
|
||||
return {
|
||||
time: moment(w.date).unix(),
|
||||
value: w.upperBand,
|
||||
}
|
||||
})
|
||||
// @ts-ignore
|
||||
upperBandSeries.setData(upperBandData)
|
||||
|
||||
const lowerBandSeries = chart.current.addLineSeries({
|
||||
color: '#4ECDC4', // Teal for volatility protection bands
|
||||
lineWidth: 1,
|
||||
priceLineVisible: false,
|
||||
priceLineWidth: 1,
|
||||
title: 'Volatility Protection Lower Band',
|
||||
pane: 0,
|
||||
lineStyle: LineStyle.Dotted,
|
||||
})
|
||||
|
||||
const lowerBandData = indicatorsValues.BollingerBandsVolatilityProtection.bollingerBands?.map((w) => {
|
||||
return {
|
||||
time: moment(w.date).unix(),
|
||||
value: w.lowerBand,
|
||||
}
|
||||
})
|
||||
// @ts-ignore
|
||||
lowerBandSeries.setData(lowerBandData)
|
||||
}
|
||||
|
||||
if (markers.length > 0) {
|
||||
series1.current.setMarkers(markers)
|
||||
}
|
||||
@@ -674,6 +633,95 @@ const TradeChart = ({
|
||||
paneCount++
|
||||
}
|
||||
|
||||
// Display Bollinger Bands Volatility Protection Width on separate pane
|
||||
if (indicatorsValues?.BollingerBandsVolatilityProtection != null) {
|
||||
const volatilityWidthSeries = chart.current.addLineSeries({
|
||||
color: '#8B5CF6', // Purple for volatility width
|
||||
lineWidth: 2,
|
||||
priceLineVisible: true,
|
||||
priceLineWidth: 1,
|
||||
title: 'Volatility Width (BB %)',
|
||||
pane: paneCount,
|
||||
priceFormat: {
|
||||
minMove: 0.001,
|
||||
precision: 3,
|
||||
type: 'price',
|
||||
},
|
||||
})
|
||||
|
||||
const volatilityWidthData = indicatorsValues.BollingerBandsVolatilityProtection.bollingerBands?.map((w) => {
|
||||
return {
|
||||
time: moment(w.date).unix(),
|
||||
value: w.width,
|
||||
}
|
||||
})
|
||||
// @ts-ignore
|
||||
volatilityWidthSeries.setData(volatilityWidthData)
|
||||
|
||||
// Add confidence range lines (0.02 - 0.10)
|
||||
const confidenceMinLine = chart.current.addLineSeries({
|
||||
color: '#16A34A', // Green for confidence range minimum
|
||||
lineWidth: 1,
|
||||
priceLineVisible: true,
|
||||
priceLineWidth: 1,
|
||||
title: 'Conf Min (2%)',
|
||||
pane: paneCount,
|
||||
lineStyle: LineStyle.Dashed,
|
||||
priceFormat: {
|
||||
minMove: 0.001,
|
||||
precision: 3,
|
||||
type: 'price',
|
||||
},
|
||||
})
|
||||
|
||||
const confidenceMaxLine = chart.current.addLineSeries({
|
||||
color: '#16A34A', // Green for confidence range maximum
|
||||
lineWidth: 1,
|
||||
priceLineVisible: true,
|
||||
priceLineWidth: 1,
|
||||
title: 'Conf Max (10%)',
|
||||
pane: paneCount,
|
||||
lineStyle: LineStyle.Dashed,
|
||||
priceFormat: {
|
||||
minMove: 0.001,
|
||||
precision: 3,
|
||||
type: 'price',
|
||||
},
|
||||
})
|
||||
|
||||
// Create horizontal lines for confidence range
|
||||
const bollingerBands = indicatorsValues.BollingerBandsVolatilityProtection.bollingerBands
|
||||
if (bollingerBands && bollingerBands.length > 0) {
|
||||
const confidenceMinData = [
|
||||
{
|
||||
time: moment(bollingerBands[0].date).unix(),
|
||||
value: 0.02, // Confidence minimum threshold
|
||||
},
|
||||
{
|
||||
time: moment(bollingerBands[bollingerBands.length - 1].date).unix(),
|
||||
value: 0.02, // Confidence minimum threshold
|
||||
}
|
||||
]
|
||||
// @ts-ignore
|
||||
confidenceMinLine.setData(confidenceMinData)
|
||||
|
||||
const confidenceMaxData = [
|
||||
{
|
||||
time: moment(bollingerBands[0].date).unix(),
|
||||
value: 0.10, // Confidence maximum threshold
|
||||
},
|
||||
{
|
||||
time: moment(bollingerBands[bollingerBands.length - 1].date).unix(),
|
||||
value: 0.10, // Confidence maximum threshold
|
||||
}
|
||||
]
|
||||
// @ts-ignore
|
||||
confidenceMaxLine.setData(confidenceMaxData)
|
||||
}
|
||||
|
||||
paneCount++
|
||||
}
|
||||
|
||||
if (indicatorsValues?.LaggingStc != null) {
|
||||
const laggingStcSeries = chart.current.addBaselineSeries({
|
||||
pane: paneCount,
|
||||
|
||||
Reference in New Issue
Block a user