Library "lib_hlm"
Ichimoku trend line and plotting tools.

HLM(Period)
  Optionless Ichimoku/Donchian trend line calculation.
  Parameters:
    Period: The period for the trend line calculation.
  Returns: The midpoint of the highest high and the lowest low.

HLM_Offset(offset, currentIsZero, intoPast)
  Standardized language for plotting offsets.
  Parameters:
    offset: The offset number to use.
    currentIsZero: `true` for ichimoku counting. `false` for natural language
    intoPast: `true` if projecting backwards. `false` if projecting forwards.
  Returns: The offset adjusted by counting style and direction.

TK()
  Calculates the Ichimoku Tenkan and Kijun lines.
  Returns: {tenkan, kijun}

SenkouSpans(period_1, period_2, period_3)
  Calculates the Ichimoku Senkou Span A and Senkou Span B values.
  Parameters:
    period_1: default=9
    period_2: default=26
    period_3: default=52
  Returns: {senkou_a, senkou_b}

Ichimoku_Cloud(period_1, period_2, period_3)
  Calculate the Ichimoku cloud value and offsets.
  Parameters:
    period_1: default=9
    period_2: default=26
    period_3: default=52
  Returns: {senkou_a, senkou_b, cloud_offset}

Chikou_Span()
  Gets the chikou span and offsets.
  Returns: {chikou, chikou_offset}

Ichimoku(enabled)
  Get the values for the full, default Ichimoku system, including plotting offsets. Common toggle for all values.
  Parameters:
    enabled: `true` will return plottable values. `false` will return only na's (turns off plotting).
  Returns: {tenkan, kijun, senkou_a, senkou_b, cloud_offset, chikou, chikou_offset}

Ichimoku_Line_Colors()
  Get a set of colors with a common transparency for Ichimoku.
  Returns: {tenkan_color, kijun_color, senkou_a_color, senkou_b_color, chikou_color}

Ichimoku_Cloud_Color()
  Determines the cloud color and applies transparency (Ichimoku).
  Returns: the dominant lines color with applied transparency

Ichimoku_Colors()
  Gets a full set of default ichimoku colors with cloud color based on the input senkou values.
  Returns: {tenkan_color, kijun_color, senkou_a_color, senkou_b_color, chikou_color, cloud_color}

Pine library

In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House Rules.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this library?

Copy the following line and paste it in your script.