feat(visualizer): add build overlay toggle
Default is off so candles match production; enable via the new Build button when needed.
This commit is contained in:
@@ -25,6 +25,7 @@ type Props = {
|
||||
ema20?: SeriesPoint[];
|
||||
bb20?: { upper: SeriesPoint[]; lower: SeriesPoint[]; mid: SeriesPoint[] };
|
||||
showIndicators: boolean;
|
||||
showBuild: boolean;
|
||||
bucketSeconds: number;
|
||||
seriesKey: string;
|
||||
fib?: FibRetracement | null;
|
||||
@@ -116,6 +117,7 @@ export default function TradingChart({
|
||||
ema20,
|
||||
bb20,
|
||||
showIndicators,
|
||||
showBuild,
|
||||
bucketSeconds,
|
||||
seriesKey,
|
||||
fib,
|
||||
@@ -596,12 +598,29 @@ export default function TradingChart({
|
||||
s.bbLower?.setData(bbLower);
|
||||
s.bbMid?.setData(bbMid);
|
||||
|
||||
s.build.applyOptions({ visible: showBuild });
|
||||
if (!showBuild) {
|
||||
buildSamplesRef.current.clear();
|
||||
buildKeyRef.current = seriesKey;
|
||||
lastBuildCandleStartRef.current = null;
|
||||
s.build.setData([]);
|
||||
}
|
||||
|
||||
if (buildKeyRef.current !== seriesKey) {
|
||||
buildSamplesRef.current.clear();
|
||||
buildKeyRef.current = seriesKey;
|
||||
lastBuildCandleStartRef.current = null;
|
||||
}
|
||||
|
||||
if (!showBuild) {
|
||||
s.sma20?.applyOptions({ visible: showIndicators });
|
||||
s.ema20?.applyOptions({ visible: showIndicators });
|
||||
s.bbUpper?.applyOptions({ visible: showIndicators });
|
||||
s.bbLower?.applyOptions({ visible: showIndicators });
|
||||
s.bbMid?.applyOptions({ visible: showIndicators });
|
||||
return;
|
||||
}
|
||||
|
||||
const bs = resolveBucketSeconds(bucketSeconds, candles);
|
||||
const eps = 1e-3;
|
||||
const maxPointsPerCandle = 600;
|
||||
@@ -714,7 +733,21 @@ export default function TradingChart({
|
||||
s.bbUpper?.applyOptions({ visible: showIndicators });
|
||||
s.bbLower?.applyOptions({ visible: showIndicators });
|
||||
s.bbMid?.applyOptions({ visible: showIndicators });
|
||||
}, [candleData, volumeData, oracleData, smaData, emaData, bbUpper, bbLower, bbMid, showIndicators, candles, bucketSeconds, seriesKey]);
|
||||
}, [
|
||||
candleData,
|
||||
volumeData,
|
||||
oracleData,
|
||||
smaData,
|
||||
emaData,
|
||||
bbUpper,
|
||||
bbLower,
|
||||
bbMid,
|
||||
showIndicators,
|
||||
showBuild,
|
||||
candles,
|
||||
bucketSeconds,
|
||||
seriesKey,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
const s = seriesRef.current;
|
||||
|
||||
Reference in New Issue
Block a user