Ichimoku Cloud
Created by Goichi Hosoda (細田悟一, Hosoda Goichi), Ichimoku Cloud, also known as Ichimoku Kinkō Hyō, is a collection of indicators that depict support and resistance, momentum, and trend direction. [Discuss] 💬
// C# usage syntax
IReadOnlyList<IchimokuResult> results =
bars.ToIchimoku(tenkanPeriods, kijunPeriods, senkouBPeriods);
// usage with custom offset
IReadOnlyList<IchimokuResult> results =
bars.ToIchimoku(tenkanPeriods, kijunPeriods, senkouBPeriods, offsetPeriods);
// usage with different custom offsets
IReadOnlyList<IchimokuResult> results =
bars.ToIchimoku(tenkanPeriods, kijunPeriods, senkouBPeriods, senkouOffset, chikouOffset);Create a buffer list and add each bar as it arrives:
IchimokuList ichimokuList = new(tenkanPeriods, kijunPeriods, senkouBPeriods);
// the offset overloads of the Series method apply here too
// call from your WebSocket or SSE message handler
void OnBarReceived(IBar bar) => ichimokuList.Add(bar);
// the list itself holds the results; fills as the handler runs
IReadOnlyList<IchimokuResult> results = ichimokuList;See Buffer lists for the full usage guide.
Subscribe to a BarHub and add each bar as it arrives:
BarHub barHub = new();
IchimokuHub observer = barHub.ToIchimokuHub(tenkanPeriods, kijunPeriods, senkouBPeriods);
// or with one offset: .ToIchimokuHub(tenkanPeriods, kijunPeriods, senkouBPeriods, offsetPeriods)
// call from your WebSocket or SSE message handler
void OnBarReceived(IBar bar) => barHub.Add(bar);
// results fill as the handler runs
IReadOnlyList<IchimokuResult> results = observer.Results;See Stream hubs for the full usage guide.
Parameters
| param | description |
|---|---|
tenkanPeriodsint | Number of periods (T) in the Tenkan-sen midpoint evaluation. Must be greater than 0. Default is 9. |
kijunPeriodsint | Number of periods (K) in the shorter Kijun-sen midpoint evaluation. Must be greater than 0. Default is 26. |
senkouBPeriodsint | Number of periods (S) in the longer Senkou leading span B midpoint evaluation. Must be greater than K. Default is 52. |
offsetPeriodsint | Optional. Number of periods to offset both Senkou and Chikou spans. Must be non-negative. Default is kijunPeriods. |
senkouOffsetint | Optional. Number of periods to offset the Senkou span. Must be non-negative. Default is kijunPeriods. |
chikouOffsetint | Optional. Number of periods to offset the Chikou span. Must be non-negative. Default is kijunPeriods. |
See overloads usage above to determine which parameters are relevant for each. If you are customizing offsets, all parameter arguments must be specified.
Historical price bars requirements
You must have at least the greater of T,K, S, and offset periods for bars to cover the warmup periods; though, given the leading and lagging nature, we recommend notably more.
bars is a collection of generic TBar historical price bars. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.
Response
IReadOnlyList<IchimokuResult>- This method returns a time series of all available indicator values for the
barsprovided. - It always returns the same number of elements as there are in the historical price bars.
- It does not return a single incremental indicator value.
- The first
T-1,K-1, andS-1periods will have variousnullvalues since there's not enough data to calculate. Custom offset periods may also increasenullresults for warmup periods.
IchimokuList : IReadOnlyList<IchimokuResult>- The list itself holds the results, one for each bar or value added, in timestamp order.
- It keeps up to 100,000 results by default and drops the oldest beyond that; set
MaxListSizeto keep fewer. - The first
T-1,K-1, andS-1periods will have variousnullvalues since there's not enough data to calculate. Custom offset periods may also increasenullresults for warmup periods.
IReadOnlyList<IchimokuResult> results = observer.Results;observer.Resultsholds the results, one for each bar in theBarHubcache, in timestamp order.- Results update as bars arrive, including bars that arrive late or are revised.
- The cache keeps up to 100,000 results by default; set
maxCacheSizeon theBarHubto keep fewer. - The first
T-1,K-1, andS-1periods will have variousnullvalues since there's not enough data to calculate. Custom offset periods may also increasenullresults for warmup periods.
IchimokuResult
| property | description |
|---|---|
TimestampDateTime | Date from evaluated TBar |
TenkanSendouble? | Conversion / signal line |
KijunSendouble? | Base line |
SenkouSpanAdouble? | Leading span A |
SenkouSpanBdouble? | Leading span B |
ChikouSpandouble? | Lagging span |
Chaining
This indicator must be generated from bars and cannot be generated from results of another chain-enabled indicator or method.
Results cannot be further chained with additional transforms.
See Chaining indicators for more.
Utilities
Call these on the list itself, as in ichimokuList.Find(lookupDate). .Condense() returns a new list and leaves ichimokuList unchanged.
Warmup removal is left out. Once the list is full it drops its oldest results, so trimming by position would remove valid values.
Call these on observer.Results, as in observer.Results.Find(lookupDate). .Condense() returns a new list and leaves the hub's results unchanged.
Warmup removal is left out. Once the cache is full the hub drops its oldest results, so trimming by position would remove valid values.
See Utilities and helpers for more information.