DocsStrategy APIindicators

ICHIMOKU (Ichimoku Cloud)

Ichimoku Kinko Hyo ("one glance equilibrium chart") is a comprehensive indicator system providing trend direction, support/resistance, and momentum signals through five lines.

Declaration

function init(ctx) { ctx.indicator('ichimoku', 'ICHIMOKU', { tenkanPeriod: 9, kijunPeriod: 26, senkouBPeriod: 52 }); }

Options

OptionTypeDefaultDescription
tenkanPeriodnumber9Tenkan-sen (conversion line) period
kijunPeriodnumber26Kijun-sen (base line) period
senkouBPeriodnumber52Senkou Span B period

Output

Returns an object with five series, accessed via underscore naming:

PropertyDescription
tenkanTenkan-sen (conversion line) - fast signal
kijunKijun-sen (base line) - trend confirmation
senkouASenkou Span A - leading cloud edge
senkouBSenkou Span B - lagging cloud edge
chikouChikou Span (lagging line) - close shifted back

Accessing Values

function onBar(ctx, i) { const tenkan = ctx.ind.ichimoku_tenkan[i]; const kijun = ctx.ind.ichimoku_kijun[i]; const senkouA = ctx.ind.ichimoku_senkouA[i]; const senkouB = ctx.ind.ichimoku_senkouB[i]; const chikou = ctx.ind.ichimoku_chikou[i]; }

Use Cases

TK Cross (Tenkan/Kijun Crossover)

function onBar(ctx, i) { const tenkan = ctx.ind.ichimoku_tenkan; const kijun = ctx.ind.ichimoku_kijun; const close = ctx.series.close[i]; const cloudTop = Math.max(ctx.ind.ichimoku_senkouA[i], ctx.ind.ichimoku_senkouB[i]); // Bullish: TK cross above the cloud if (q.crossOver(tenkan, kijun, i) && close > cloudTop) { ctx.order.market('ASSET', 1, { signal: 'buy', reason: 'tk_cross_above_cloud' }); } }

Cloud as Support/Resistance

function onBar(ctx, i) { const close = ctx.series.close[i]; const senkouA = ctx.ind.ichimoku_senkouA[i]; const senkouB = ctx.ind.ichimoku_senkouB[i]; const cloudTop = Math.max(senkouA, senkouB); const cloudBottom = Math.min(senkouA, senkouB); if (close > cloudTop) { // Above cloud: bullish trend } else if (close < cloudBottom) { // Below cloud: bearish trend } else { // Inside cloud: consolidation / no-trade zone } }

Calculation

  • Tenkan-sen = (Highest High + Lowest Low) / 2 over tenkanPeriod
  • Kijun-sen = (Highest High + Lowest Low) / 2 over kijunPeriod
  • Senkou Span A = (Tenkan + Kijun) / 2
  • Senkou Span B = (Highest High + Lowest Low) / 2 over senkouBPeriod
  • Chikou Span = Close shifted back kijunPeriod bars

Related

  • Donchian - Underlying channel concept
  • EMA - Simpler trend following
  • ADX - Trend strength measurement
indicatorichimokucloudtrendsupportresistanceqsl