RicardoSantos

[RS]MTF Ichimoku Cloud V0

Request for T_C

The displacement cant be converted (a approximation is possible by calculating the n_bars the time frame occupies by the displacement).
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

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 script on a chart?
study(title='[RS]MTF Ichimoku Cloud V0', shorttitle='IC', overlay=true)
tf = input(title='Timeframe:', type=string, defval='D', confirm=false)
conversionPeriods = input(title='Conversion Periods:', type=integer, defval=9, minval=1),
basePeriods = input(title='Base Periods', type=integer, defval=26, minval=1)
laggingSpan2Periods = input(title='Lagging Span:', type=integer, defval=52, minval=1),
displacement = input(title='Displacement:', type=integer, defval=26, minval=1)

f_donchian(_len) => avg(lowest(_len), highest(_len))

f_ichimoku_cloud(_conversion_periods, _base_periods, _lagging_span)=>
    _conversion_line = f_donchian(_conversion_periods)
    _base_line = f_donchian(_base_periods)
    _lead_line1 = avg(_conversion_line, _base_line)
    _lead_line2 = f_donchian(_lagging_span)
    [_conversion_line, _base_line, _lead_line1, _lead_line2]

[conversionLine, baseLine, leadLine1, leadLine2] = f_ichimoku_cloud(conversionPeriods, basePeriods, laggingSpan2Periods)

s0 = security(tickerid, tf, offset(leadLine1, displacement))
s1 = security(tickerid, tf, offset(leadLine2, displacement))
s2 = security(tickerid, tf, baseLine)
s3 = security(tickerid, tf, conversionLine)

ps0 = plot(title='A', series=s0, color=green, linewidth=2)
ps1 = plot(title='B', series=s1, color=red, linewidth=2)
fill(title='AB', plot1=ps0, plot2=ps1, color=blue, transp=80)
plot(title='Base', series=s2, color=blue, linewidth=1)
plot(title='Conversion', series=s3, color=orange, linewidth=1)