Ichimoku
선 다섯 + 구름 — 혼자서도 화면 하나가 필요하다. 선행·후행은 인덱스 이동이라 마지막 캔들 너머의 구름은 그리지 않는다(미래 x를 지어내지 않는다).
소스
apps/examples/src/cases/ichimoku.ts — CI가 타입체크하는 실물이다.
ts
import { PlotBuilder, browserDeps } from "@finchart/dom";
import type { OHLC } from "@finchart/core";
import { candleSeries, priceFormat, timeTicks } from "@finchart/core";
import { legend } from "@finchart/dom";
import { attachIchimoku } from "@finchart/indicators";
import { fixtureCandles } from "./fixture";
import { chartHost } from "./stage";
export const title = "Ichimoku";
export const description =
"선 다섯 + 구름 — 혼자서도 화면 하나가 필요하다. 선행·후행은 인덱스 이동이라 마지막 캔들 너머의 구름은 그리지 않는다(미래 x를 지어내지 않는다).";
export function mount(container: HTMLElement): () => void {
const host = chartHost(container, 480);
const plot = PlotBuilder.create<OHLC>(browserDeps({ autoSize: true }))
.setSize(container.clientWidth || 900, 480)
.setAxis({
x: { ticks: timeTicks({ timeZone: "UTC", locale: "ko" }) },
y: { position: "right", format: priceFormat({ compact: true, locale: "ko" }) },
})
.build(host);
const price = plot.mainPane.addSeries({
series: candleSeries(),
data: fixtureCandles(),
name: "가격",
});
plot.mainPane.use(attachIchimoku({ source: price }));
plot.use(legend({}));
return Object.assign(
() => {
plot.destroy();
host.remove();
},
{ requestRender: () => plot.requestRender() },
);
}