알림목록 매매시그널 표시

This commit is contained in:
Macbook
2026-06-10 10:38:55 +09:00
parent 1ec22d6ea2
commit 55b1c75226
2 changed files with 15 additions and 5 deletions
+11 -3
View File
@@ -2,6 +2,7 @@
* 알림 목록 미니 차트 — 매매 시그널 마커
*/
import type { ChartManager } from './ChartManager';
import { normalizeEpochSec } from './backtestUiUtils';
export interface TradeSignalChartMarker {
candleTime: number;
@@ -46,7 +47,9 @@ export function buildNotificationSignalMarkers(
marker: TradeSignalChartMarker | undefined,
): Array<{ time: number; type: string; price: number }> {
if (!marker || !Number.isFinite(marker.price) || marker.price <= 0) return [];
const time = resolveSignalMarkerBarTime(mgr, marker.candleTime);
const candleTimeSec = normalizeEpochSec(marker.candleTime);
if (candleTimeSec <= 0) return [];
const time = resolveSignalMarkerBarTime(mgr, candleTimeSec);
if (time == null) return [];
return [{ time, type: marker.signalType, price: marker.price }];
}
@@ -56,10 +59,15 @@ export function applyNotificationSignalMarkers(
marker: TradeSignalChartMarker | undefined,
showPrice = false,
): void {
const signals = buildNotificationSignalMarkers(mgr, marker);
if (signals.length === 0) {
if (!marker) {
mgr.clearBacktestMarkers();
return;
}
// 차트·캔들 미준비 시 조기 clearBacktestMarkers() 호출 금지 (레이아웃/지표 로드 레이스)
if (!mgr.hasMainSeries() || mgr.getRawBarsLength() < 2) return;
const signals = buildNotificationSignalMarkers(mgr, marker);
if (signals.length === 0) return;
mgr.setBacktestMarkers(signals, showPrice);
}