8.1.5 Ichimoku is wrong

The updated Ichimoku indicator that came with 8.1.5 update is wrong:

  1. Chikou looks like it plots at the price from 26 bars ago and not the current price moved back 26 bars.

  2. Tenkan-sen and Kijun-sen Plotting: Currently, Values[0] (Tenkan) and Values[1] (Kijun) are plotted with normalDisplacement (which is Math.Abs(SpanDisplacement), default 26). This means they are plotted 26 bars into the past. Standard Ichimoku plots these lines at the current bar (i.e., with a displacement of 0). You might want to change Values[0][normalDisplacement] to Values[0][0] and Values[1][normalDisplacement] to Values[1][0].

  3. Indicator Calculation Start: The guard condition if (CurrentBar <= Math.Max(Math.Max(ConversionPeriod, BasePeriod), LeadingSpanBPeriod) + totalLag) in OnBarUpdate() (and a similar one in OnRender()) uses totalLag. With default settings, totalLag is 52. This means the indicator won’t start calculating/rendering until CurrentBar is greater than 52 + 52 = 104. A more typical approach is to start calculations as soon as enough data for the longest calculation period is available (i.e., when CurrentBar >= LeadingSpanBPeriod - 1). This late start might be intentional for some reason, but it’s worth noting.

I made these changes and now the indicator matches other platforms within a few ticks.

3 Likes