일목균형표 구름 draw 루프 디버그 로그 추가
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -70,30 +70,31 @@ class CloudRenderer implements IPrimitivePaneRenderer {
|
|||||||
console.log('[IchimokuCloud] draw: skipped, data.length=', this._data.length);
|
console.log('[IchimokuCloud] draw: skipped, data.length=', this._data.length);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('[IchimokuCloud] draw called. data.length:', this._data.length, 'bullish:', this._bullishVisible, 'bearish:', this._bearishVisible);
|
|
||||||
const timeScale = this._chart.timeScale();
|
const timeScale = this._chart.timeScale();
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
target.useBitmapCoordinateSpace(({ context: ctx, horizontalPixelRatio: hpr, verticalPixelRatio: vpr }: any) => {
|
target.useBitmapCoordinateSpace(({ context: ctx, horizontalPixelRatio: hpr, verticalPixelRatio: vpr }: any) => {
|
||||||
|
let drawn = 0, skippedTime = 0, skippedPrice = 0;
|
||||||
for (let i = 0; i < this._data.length - 1; i++) {
|
for (let i = 0; i < this._data.length - 1; i++) {
|
||||||
const a = this._data[i];
|
const a = this._data[i];
|
||||||
const b = this._data[i + 1];
|
const b = this._data[i + 1];
|
||||||
|
|
||||||
const x1 = timeScale.timeToCoordinate(a.time as Time);
|
const x1 = timeScale.timeToCoordinate(a.time as Time);
|
||||||
const x2 = timeScale.timeToCoordinate(b.time as Time);
|
const x2 = timeScale.timeToCoordinate(b.time as Time);
|
||||||
if (x1 == null || x2 == null) continue;
|
if (x1 == null || x2 == null) { skippedTime++; continue; }
|
||||||
|
|
||||||
const aAy = this._series.priceToCoordinate(a.spanA);
|
const aAy = this._series.priceToCoordinate(a.spanA);
|
||||||
const aBy = this._series.priceToCoordinate(a.spanB);
|
const aBy = this._series.priceToCoordinate(a.spanB);
|
||||||
const bAy = this._series.priceToCoordinate(b.spanA);
|
const bAy = this._series.priceToCoordinate(b.spanA);
|
||||||
const bBy = this._series.priceToCoordinate(b.spanB);
|
const bBy = this._series.priceToCoordinate(b.spanB);
|
||||||
if (aAy == null || aBy == null || bAy == null || bBy == null) continue;
|
if (aAy == null || aBy == null || bAy == null || bBy == null) { skippedPrice++; continue; }
|
||||||
|
|
||||||
// 한국 관례: SpanA > SpanB → 양운(빨강), SpanA <= SpanB → 음운(청록)
|
// 한국 관례: SpanA > SpanB → 양운(빨강), SpanA <= SpanB → 음운(청록)
|
||||||
const bullish = (a.spanA + b.spanA) > (a.spanB + b.spanB);
|
const bullish = (a.spanA + b.spanA) > (a.spanB + b.spanB);
|
||||||
if (bullish && !this._bullishVisible) continue;
|
if (bullish && !this._bullishVisible) continue;
|
||||||
if (!bullish && !this._bearishVisible) continue;
|
if (!bullish && !this._bearishVisible) continue;
|
||||||
|
|
||||||
|
drawn++;
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(x1 * hpr, aAy * vpr);
|
ctx.moveTo(x1 * hpr, aAy * vpr);
|
||||||
@@ -105,6 +106,11 @@ class CloudRenderer implements IPrimitivePaneRenderer {
|
|||||||
ctx.fill();
|
ctx.fill();
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
}
|
}
|
||||||
|
if (skippedTime > 0 || skippedPrice > 0 || drawn === 0) {
|
||||||
|
console.warn('[IchimokuCloud] draw result: drawn=', drawn, 'skippedTime=', skippedTime, 'skippedPrice=', skippedPrice,
|
||||||
|
'sample time0=', this._data[0]?.time, 'x1_0=', timeScale.timeToCoordinate(this._data[0]?.time as Time),
|
||||||
|
'spanA0=', this._data[0]?.spanA, 'priceCoord=', this._series.priceToCoordinate(this._data[0]?.spanA));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user