Indicator · Pine Script v5 · On the chart

Ichimoku Cloud

by harryguiacorn· code credited to FxCloudTrader

This indicator plots Ichimoku Cloud elements on the price chart, including Tenkan-sen, Kijun-sen, Senkou Span A and B lines with optional Chikou Span.

View on GitHub

GitHub stars219on the repository
Pine versionv5runs as is
Lines of code348
Settings28inputs
LicenceNone statedfile: MPL-2.0
Last update1 year ago8 May 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

348 lines of Pine Script v5 from Cloud.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Cloud.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © FxCloudTrader

//@version=5
indicator('Ichimoku Cloud', 'Cloud', overlay=true)
//-------------------- parameters --------------------
atr = ta.atr(14)
offset_atr_arrow = 0.2

//---------------- functions ----------------
GetCorrectTickValue(value) =>
    pipSizeCalc = (syminfo.type == "forex" ? syminfo.mintick * 10 : 1)
    value / pipSizeCalc

getMidPoint(__len, __offset) =>
    MidPointOffset = math.avg(ta.lowest(__len)[__offset], ta.highest(__len)[__offset])

getKijun(__symbol, __len, __timeframe, __offset=0)=>
    __k_request = getMidPoint(__len, __offset)
    k = request.security(__symbol, __timeframe, __k_request)

getTankan(__symbol, __len, __timeframe, __offset=0)=>
    __k_request = getMidPoint(__len, __offset)
    k = request.security(__symbol, __timeframe, __k_request)

getSenkou_spanA(__symbol, __timeframe, __conversionLine, __baseLine)=>
    __k_request = math.avg(__conversionLine, __baseLine)
    k = request.security(__symbol, __timeframe, __k_request)

getSenkou_spanB(__symbol, __timeframe, __senkou2Periods)=>
    __k_request = getMidPoint(__senkou2Periods, 0)
    k = request.security(__symbol, __timeframe, __k_request)

getCloudDirectionMultiTF(__symbol, __timeframe, __offset=0)=>
    __c_request = getMidPoint(26, __offset)
    c = request.security(__symbol, __timeframe, __c_request)

setLocationByATR(con_dn, con_up, offset) =>
    float con_dn_loc1 = na
    if con_dn
        con_dn_loc1 := high + offset * atr
    float con_up_loc1 = na
    if con_up
        con_up_loc1 := low - offset * atr
    [con_dn_loc1, con_up_loc1]
//---------------- functions ----------------
var grp1 = "Ichimoku Cloud"
bool display_ichimoku = input.bool(true, 'Enable Ichimoku Cloud', group = grp1)
bool display_chikou_span = input.bool(true, 'Enable Chikou Span', group = grp1)// Default is off, as it can be messy if otherwise
bool display_chikou_span_filter_by_kijun = input.bool(false, 'Enable Chikou Span when Kijun-sen changes direction', group = grp1)
bool display_kijun_arrow = input.bool(false, 'Enable Kijun Arrow', group = grp1)
bool display_tk_cross = input.bool(true, 'Enable Tenkan-sen and Kijun-sen crosses', group = grp1)
conversionPeriods = input.int(9, minval=1, title='Tenkan-Sen (Conversion Line) Periods')
basePeriodsK = input.int(26, minval=1, title='Kijun-Sen (Base Line) Periods')
Kijun = getMidPoint(basePeriodsK, 0)
//MODIFIED FROM OFFICIAL ICHIMOKU PINE SCRIPT
senkou2Periods = input.int(52, minval=1, title='Senkou Span 2 Periods', group = grp1)
_displacement = input.int(26, minval=1, title='Displacement', group = grp1)

conversionLine = getTankan(syminfo.tickerid, conversionPeriods, timeframe.period) //conversionLine = getMidPoint(conversionPeriods, 0)
baseLine = getKijun(syminfo.tickerid, basePeriodsK, timeframe.period)// baseLine = getMidPoint(basePeriodsK, 0)
leadLine1 = getSenkou_spanA(syminfo.tickerid, timeframe.period, conversionLine, baseLine) // math.avg(conversionLine, baseLine)
leadLine2 = getSenkou_spanB(syminfo.tickerid, timeframe.period, senkou2Periods) //getMidPoint(senkou2Periods, 0)
plot(display_ichimoku?conversionLine:na, color=color.new(color.fuchsia, 50), linewidth=4, title='Tenkan-Sen (Conversion Line)', style = plot.style_stepline)
plot(display_ichimoku?baseLine:na, color=color.new(color.blue, 20), linewidth=4, title='Kijun-Sen (Base Line)', style = plot.style_stepline)
plot(display_ichimoku?close:na, offset=-_displacement, color=color.new(color.white, 0), title='Chikou Span (Lagging Line)', style=plot.style_circles, linewidth=2, display = display_chikou_span? display.all: display.none)
p1 = plot(display_ichimoku?leadLine1:na, offset=_displacement, color=color.new(color.green, 50), title='Senkou Span (Lead 1)')
p2 = plot(display_ichimoku?leadLine2:na, offset=_displacement, color=color.new(color.red, 50), title='Senkou Span (Lead 2)')
fill(p1, p2, color=leadLine1 > leadLine2 ? color.new(color.green, 80) : color.new(color.red, 80))

//END OF OFFICIAL ICHIMOKU PINE SCRIPT

//Alert for Tenkan-sen and Kijun-sen crosses
alert_tk_cross_up = ta.crossover(conversionLine, baseLine)
alert_tk_cross_dn = ta.crossunder(conversionLine, baseLine)
alertcondition(condition=alert_tk_cross_up or alert_tk_cross_dn, title = "TKx Alert",
     message="TK cross: {{ticker}} {{interval}} {{time}}")
alertcondition(condition=alert_tk_cross_up, title = "TKx Up Alert",
     message="TK cross up: {{ticker}} {{interval}} {{time}}")
alertcondition(condition= alert_tk_cross_dn, title = "TKx Down Alert",
     message="TK cross down: {{ticker}} {{interval}} {{time}}")
// if alert_tk_cross_up
//     alert("TK cross up: {{ticker}} {{interval}} {{time}}", alert.freq_once_per_bar_close)
// else if alert_tk_cross_dn
//     alert("TK cross down: {{ticker}} {{interval}} {{time}}", alert.freq_once_per_bar_close)

//End of alert for Tenkan-sen and Kijun-sen crosses

// Tenkan-sen and Kijun-sen crosses
bool con_up_tk = ta.crossover(conversionLine, baseLine)
bool con_dn_tk = ta.crossunder(conversionLine, baseLine)
// [con_dn_tk_arrow_loc, con_up_tk_arrow_loc] = setLocationByATR(con_dn_tk, con_up_tk, offset_atr_arrow)
// plotchar(con_up_tk_arrow_loc, title='TKx up', char = "⬆", location = location.absolute, color =color.new(color.black, 0), size = size.auto, display = display_ichimoku and display_tk_cross?display.all:display.none)
// plotchar(con_dn_tk_arrow_loc, title='TKx dn', char = "⬇", location = location.absolute, color =color.new(color.black, 0), size = size.auto, display = display_ichimoku and display_tk_cross?display.all:display.none)
plotshape(con_up_tk, title= "TKx up", style = shape.arrowup, location = location.belowbar, color = color.green, size = size.auto, display = display_ichimoku and display_tk_cross?display.all:display.none)
plotshape(con_dn_tk, title= "TKx dn", style = shape.arrowdown, location = location.abovebar, color = color.red, size = size.auto, display = display_ichimoku and display_tk_cross?display.all:display.none)

//Get the current direction of the TKx, 1 is bullish crosses, -1 is bearish crosses
var con_tk_current = 0
var con_tf_previous = 0
if con_up_tk
    con_tk_current := 1
else if con_dn_tk
    con_tk_current := -1
// else
//     0
var tk_signal_count = 0
if con_tk_current == con_tf_previous and con_tk_current == 1
    tk_signal_count += 1
else if con_tk_current == con_tf_previous and con_tk_current == -1
    tk_signal_count += -1
else 
    tk_signal_count := 0
con_tf_previous := con_tk_current
// End of Tenkan-sen and Kijun-sen crosses


//Kijun-sen arrows
int _curArrowDirection = if Kijun[0] - Kijun[1] > 0
    1
else if Kijun[0] - Kijun[1] < 0
    -1
var _existingArrowDirection = 0
int _newDirection = 0
if _curArrowDirection != _existingArrowDirection and _curArrowDirection != 0
    _newDirection := _curArrowDirection
    _existingArrowDirection := _curArrowDirection

bool _bChikouSpanLn = close[0] > close[_displacement]
bool _bChikouSpanSt = close[0] < close[_displacement]

cond_dn_arrow = _newDirection==-1
cond_up_arrow = _newDirection==1
[con_dn_arrow_loc, con_up_arrow_loc] = setLocationByATR(cond_dn_arrow, cond_up_arrow, offset_atr_arrow)

// I'm using plotchar instead to place arrows above or below Kijunsen, which saves space for other signals
// plotarrow(_newDirection, title='Kijun Arrow', colorup=color.new(color.black, 50), colordown=color.new(color.black, 50), minheight=15, maxheight=15) 
plotchar(con_up_arrow_loc, title='Kijun Arrow', char = "⬆", location = location.absolute, color =color.new(color.black, 0), size = size.auto, display = display_ichimoku and display_kijun_arrow?display.all:display.none)
plotchar(con_dn_arrow_loc, title='Kijun Arrow', char = "⬇", location = location.absolute, color =color.new(color.black, 0), size = size.auto, display = display_ichimoku and display_kijun_arrow?display.all:display.none)
plot(_bChikouSpanLn and _newDirection== 1   and display_ichimoku ?close:na, offset=-_displacement, color=color.new(color.green, 0), title='Chikou Span Above', style=plot.style_linebr, linewidth=8, display = display_chikou_span_filter_by_kijun?display.all:display.none)
plot(_bChikouSpanSt and _newDirection== -1  and display_ichimoku ?close:na, offset=-_displacement, color=color.new(color.red, 0),   title='Chikou Span Below', style=plot.style_linebr, linewidth=8, display = display_chikou_span_filter_by_kijun?display.all:display.none)
//End of Kijun-sen arrows


// // --------------- functions for future --------------- 
// getCloudDirection(__tickerID, __tf, __conversionPeriods, __basePeriodsK, __senkou2Periods, __offset) =>
//     __conversionLine = getTankan(__tickerID, __conversionPeriods, __tf) //conversionLine = getMidPoint(conversionPeriods, 0)
//     __baseLine = getKijun(__tickerID, __basePeriodsK, __tf)// baseLine = getMidPoint(basePeriodsK, 0)
//     __leadLine1 = getSenkou_spanA(__tickerID, __tf, __conversionLine, __baseLine) // math.avg(conversionLine, baseLine)
//     __leadLine2 = getSenkou_spanB(__tickerID, __tf, __senkou2Periods) //getMidPoint(senkou2Periods, 0)
//     if close > math.max(__leadLine1[__offset], __leadLine2[__offset])
//         1
//     else if close < math.min(__leadLine1[__offset], __leadLine2[__offset])
//         -1
//     else 
//         0
// getTableCloudColours(cloudSignal, colourUp, colourDn, colourNu) =>
//     if cloudSignal == 1
//         colourUp
//     else if cloudSignal == -1
//         colourDn
//     else
//         colourNu
// //--------------------------------- Multi-timeframe (MTF) Kijun ---------------------------------
var grp2 = "Multi-timeframe (MTF)"
bool display_mtk = input.bool(false, 'Enable Multi Timeframe Kijun-sen', group = grp2)

bool_tf1 = input.bool(true, "Enable", inline = "tf_1")
bool_tf2 = input.bool(true, "Enable", inline = "tf_2")
bool_tf3 = input.bool(true, "Enable", inline = "tf_3")
bool_tf4 = input.bool(true, "Enable", inline = "tf_4")

float chartTFInMinutes = timeframe.in_seconds() / 60
display_limit_1440  = display_mtk and timeframe.isintraday and chartTFInMinutes < 1440  and bool_tf1
display_limit_240   = display_mtk and timeframe.isintraday and chartTFInMinutes < 240   and bool_tf2
display_limit_60    = display_mtk and timeframe.isintraday and chartTFInMinutes < 60    and bool_tf3
display_limit_15    = display_mtk and timeframe.isintraday and chartTFInMinutes < 15    and bool_tf4

tf_1 = input.timeframe(title="Timeframe 1", defval="1D", options=['15', '60', '240', '1D', '1W', '1M'], inline = "tf_1")
k_1 = getKijun(syminfo.tickerid, basePeriodsK, tf_1)
plot(display_limit_1440 ? k_1 : na, color=color.purple, display = display_mtk? display.all:display.none)

tf_2 = input.timeframe(title="Timeframe 2", defval="240", options=['15', '60', '240', '1D', '1W', '1M'], inline = "tf_2")
k_2 = getKijun(syminfo.tickerid, basePeriodsK, tf_2)
plot(display_limit_240 ? k_2 : na, color=color.purple, display = display_mtk? display.all:display.none)

tf_3 = input.timeframe(title="Timeframe 3", defval="60", options=['15', '60', '240', '1D', '1W', '1M'], inline = "tf_3")
k_3 = getKijun(syminfo.tickerid, basePeriodsK, tf_3)
plot(display_limit_60 ? k_3 : na, color=color.purple, display = display_mtk? display.all:display.none)

tf_4 = input.timeframe(title="Timeframe 4", defval="15", options=['15', '60', '240', '1D', '1W', '1M'], inline = "tf_4")
k_4 = getKijun(syminfo.tickerid, basePeriodsK, tf_4)
plot(display_limit_15 ? k_4 : na, color=color.purple, display = display_mtk? display.all:display.none)

if display_mtk
    var l_k_1 = label.new(x = bar_index + 1, y = k_1, style = label.style_label_left, color = color.rgb(0, 0, 0, 100), textcolor = color.purple, text = "K-1D")
    label.set_xy(display_limit_1440 ? l_k_1 : na, x = bar_index + 1, y = k_1)
    var l_k_2 = label.new(x = bar_index + 1, y = k_2, style = label.style_label_left, color = color.rgb(0, 0, 0, 100), textcolor = color.purple, text = "K-4h")
    // label.set_text(l_k_2, str.tostring(_existingArrowDirection) + " K-4h")
    label.set_xy(display_limit_240 ? l_k_2 : na, x = bar_index + 1, y = k_2)
    var l_k_3 = label.new(x = bar_index + 1, y = k_3, style = label.style_label_left, color = color.rgb(0, 0, 0, 100), textcolor = color.purple, text = "K-1h")
    label.set_xy(display_limit_60 ? l_k_3 : na, x = bar_index + 1, y = k_3)
    var l_k_4 = label.new(x = bar_index + 1, y = k_4, style = label.style_label_left, color = color.rgb(0, 0, 0, 100), textcolor = color.purple, text = "K-15m")
    label.set_xy(display_limit_15 ? l_k_4 : na, x = bar_index + 1, y = k_4)

// ------------------ table --------------------------
// Calculate ATR in pips
trValueCur = math.round_to_mintick(GetCorrectTickValue(ta.tr(true)))
trValueDaily = request.security(syminfo.tickerid, "1D", trValueCur)
atrValueCur = math.round_to_mintick(GetCorrectTickValue(atr)) 
atrValueDaily = request.security(syminfo.tickerid, "1D", atrValueCur)

var string grp_atr = "ATR Panel"
string  tableYposInput = input.string("top", "ATR Panel position", inline = "11", options = ["top", "middle", "bottom"], group = grp_atr)
string  tableXposInput = input.string("right", "", inline = "11", options = ["left", "center", "right"], group = grp_atr)
color   bullColorInput = input.color(color.new(color.green, 30), "Above", inline = "12", group = grp_atr)
color   bearColorInput = input.color(color.new(color.red, 30), "Under", inline = "12", group = grp_atr)
color   neutColorInput = input.color(color.new(color.gray, 80), "Neutral", inline = "12", group = grp_atr)
color   textColour_atrPanel = input.color(color.new(color.white, 20), "Text Colour", inline = "12", group = grp_atr)

// int cloudSignal_1m = getCloudDirection(syminfo.tickerid, "1", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// int cloudSignal_5m = getCloudDirection(syminfo.tickerid, "5", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// int cloudSignal_15m = getCloudDirection(syminfo.tickerid, "15", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// int cloudSignal_1h = getCloudDirection(syminfo.tickerid, "60", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// int cloudSignal_4h = getCloudDirection(syminfo.tickerid, "240", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// int cloudSignal_1D = getCloudDirection(syminfo.tickerid, "D", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)

// var string grp_cloud = "Cloud Panel"
// string  tableCloudYposInput = input.string("top", "Cloud Panel position", inline = "11", options = ["top", "middle", "bottom"], group = grp_cloud)
// string  tableCloudXposInput = input.string("center", "", inline = "11", options = ["left", "center", "right"], group = grp_cloud)
// color   bullColorCloudInput = input.color(color.new(color.green, 30), "Above Cloud", inline = "12", group = grp_cloud)
// color   bearColorCloudInput = input.color(color.new(color.red, 30), "Below Cloud", inline = "12", group = grp_cloud)
// color   neutColorCloudInput = input.color(color.new(color.gray, 80), "Inside Cloud", inline = "12", group = grp_cloud)

// KijunD = getMidPoint(basePeriodsK, 0)
// request.security(syminfo.tickerid, "D", pipSizeCalc[1], lookahead=barmerge.lookahead_on)

var table panelATR = table.new(tableYposInput + "_" + tableXposInput, 4, 6)
// var table panelCloud = table.new(tableCloudYposInput + "_" + tableCloudXposInput, 12, 2)

// ----------- count candles when are above, below or inside the cloud -----------
// getCandleCountsAgainstCloud(__tf) =>
//     // Determine if the candle is above, below, or inside the cloud
//     __conversionLine = getTankan(syminfo.tickerid, conversionPeriods, __tf) //conversionLine = getMidPoint(conversionPeriods, 0)
//     __baseLine = getKijun(syminfo.tickerid, basePeriodsK, __tf)// baseLine = getMidPoint(basePeriodsK, 0)
//     __leadLine1 = getSenkou_spanA(syminfo.tickerid, __tf, __conversionLine, __baseLine) // math.avg(conversionLine, baseLine)
//     __leadLine2 = getSenkou_spanB(syminfo.tickerid, __tf, senkou2Periods) //getMidPoint(senkou2Periods, 0)
//     __cloud__span_a = request.security(syminfo.tickerid, __tf, __leadLine1[_displacement])
//     __cloud__span_b = request.security(syminfo.tickerid, __tf, __leadLine2[_displacement])

//     aboveCloud = close > __cloud__span_a and close > __cloud__span_b
//     belowCloud = close < __cloud__span_a and close < __cloud__span_b
//     insideCloud = not aboveCloud and not belowCloud

//     // Initialize count variables
//     var int aboveCount = 0
//     var int belowCount = 0
//     var int insideCount = 0

//     // Count candles based on cloud position
//     if aboveCloud
//         belowCount := 0
//         insideCount := 0
//         aboveCount := aboveCount + 1
//     else if belowCloud
//         aboveCount := 0
//         insideCount := 0
//         belowCount := belowCount + 1
//     else
//         aboveCloud := 0
//         belowCount := 0
//         insideCount := insideCount + 1

// cloudSignalCandleCount_1m = "" //request.security(syminfo.tickerid, "1", (getCandleCountsAgainstCloud("1")))
// cloudSignalCandleCount_5m = "" //request.security(syminfo.tickerid, "5", (getCandleCountsAgainstCloud("5")))
// cloudSignalCandleCount_15m = "" //request.security(syminfo.tickerid, "15", (getCandleCountsAgainstCloud("15")))
// cloudSignalCandleCount_1h = "" //request.security(syminfo.tickerid, "60", (getCandleCountsAgainstCloud("60")))
// cloudSignalCandleCount_4h = "" //request.security(syminfo.tickerid, "240", (getCandleCountsAgainstCloud("240")))
// cloudSignalCandleCount_1D = "" //request.security(syminfo.tickerid, "D", (getCandleCountsAgainstCloud("D")))
// //----------------------------------

// __conversionLine4h = getTankan(syminfo.tickerid, conversionPeriods, "240") //conversionLine = getMidPoint(conversionPeriods, 0)
// __baseLine4h = getKijun(syminfo.tickerid, basePeriodsK, "240")// baseLine = getMidPoint(basePeriodsK, 0)
// __leadLine1_4h = getSenkou_spanA(syminfo.tickerid, "240", __conversionLine4h, __baseLine4h)
// __leadLine2_4h = getSenkou_spanB(syminfo.tickerid, "240", senkou2Periods) //getMidPoint(senkou2Periods, 0)
// __cloud__span_a_4h = __leadLine1_4h[1]
// __cloud__span_b_4h = request.security(syminfo.tickerid, "240", __leadLine2_4h[_displacement])

// __conversionLine1d = getTankan(syminfo.tickerid, conversionPeriods, "D") //conversionLine = getMidPoint(conversionPeriods, 0)
// __baseLine1d = getKijun(syminfo.tickerid, basePeriodsK, "D")// baseLine = getMidPoint(basePeriodsK, 0)
// __leadLine1_1d = getSenkou_spanA(syminfo.tickerid, "D", __conversionLine1d, __baseLine1d)
// __leadLine2_1d = getSenkou_spanB(syminfo.tickerid, "D", senkou2Periods) //getMidPoint(senkou2Periods, 0)
// __cloud__span_a_1d = __leadLine1_1d[1]
// __cloud__span_b_1d = request.security(syminfo.tickerid, "D", __leadLine2_4h[_displacement])

if barstate.islast
    bgColorCur = trValueCur > atrValueCur ? bearColorInput : bullColorInput
    bgColorDaily = trValueDaily > atrValueDaily ? bearColorInput : bullColorInput
    bgColorTKx = if con_tk_current > 0 
        bullColorInput
    else if con_tk_current < 0
        bearColorInput
    else
        color.new(color.gray, 50)

    // table.cell(panelCloud, 0, 0, "1m", bgcolor = neutColorInput)
    // table.cell(panelCloud, 1, 0, "5m", bgcolor = neutColorInput)
    // table.cell(panelCloud, 2, 0, "15m", bgcolor = neutColorInput)
    // table.cell(panelCloud, 3, 0, "1h", bgcolor = neutColorInput)
    // table.cell(panelCloud, 4, 0, "4h", bgcolor = neutColorInput)
    // table.cell(panelCloud, 5, 0, "D", bgcolor = neutColorInput)
    // table.cell(panelCloud, 0, 1, str.tostring(cloudSignalCandleCount_1m), bgcolor = getTableCloudColours(cloudSignal_1m, color.green, color.red, color.gray))
    // table.cell(panelCloud, 1, 1, str.tostring(cloudSignalCandleCount_5m), bgcolor = getTableCloudColours(cloudSignal_5m, color.green, color.red, color.gray))
    // table.cell(panelCloud, 2, 1, str.tostring(cloudSignalCandleCount_15m), bgcolor = getTableCloudColours(cloudSignal_15m, color.green, color.red, color.gray))
    // table.cell(panelCloud, 3, 1, str.tostring(cloudSignalCandleCount_1h), bgcolor = getTableCloudColours(cloudSignal_1h, color.green, color.red, color.gray))
    // table.cell(panelCloud, 4, 1, str.tostring(cloudSignalCandleCount_4h), bgcolor = getTableCloudColours(cloudSignal_4h, color.green, color.red, color.gray))
    // table.cell(panelCloud, 5, 1, str.tostring(cloudSignalCandleCount_1D), bgcolor = getTableCloudColours(cloudSignal_1D, color.green, color.red, color.gray))

    // table.cell(panelATR, 0, 0, "Period", bgcolor = neutColorInput)
    table.cell(panelATR, 1, 0, "Range(D)", bgcolor = neutColorInput, text_color = textColour_atrPanel)
    table.cell(panelATR, 2, 0, "ATR(D)", bgcolor = neutColorInput, text_color = textColour_atrPanel)
    table.cell(panelATR, 3, 0, "TKx("+ timeframe.period+")", bgcolor = neutColorInput, text_color = textColour_atrPanel)

    // table.cell(panelATR, 0, 1, timeframe.period, bgcolor = neutColorInput)
    // table.cell(panelATR, 1, 1, str.tostring(trValueCur), bgcolor = bgColorCur)
    // table.cell(panelATR, 2, 1, str.tostring(atrValueCur), bgcolor = neutColorInput)

    // table.cell(panelATR, 0, 2, "D", bgcolor = neutColorInput)
    table.cell(panelATR, 1, 2, str.tostring(trValueDaily), bgcolor = bgColorDaily, text_color = textColour_atrPanel)
    table.cell(panelATR, 2, 2, str.tostring(atrValueDaily), bgcolor = neutColorInput, text_color = textColour_atrPanel)
    table.cell(panelATR, 3, 2, str.tostring(tk_signal_count), bgcolor = bgColorTKx, text_color = textColour_atrPanel)
    
    // table.cell(panelATR, 0, 3, str.tostring(__cloud__span_a_4h), bgcolor = neutColorInput)
    // table.cell(panelATR, 1, 3, str.tostring(__cloud__span_a_1d), bgcolor = neutColorInput)
    // table.cell(panelATR, 2, 3, str.tostring(cloudSignal_1D), bgcolor = neutColorInput)
    // table.cell(panelATR, 0, 0, str.tostring(_existingArrowDirection))


// -------------------------------- Parabolic SAR --------------------------------
var grp_parsar = "Parabolic SAR"
bool display_parsar = input.bool(false, 'Enable Parabolic SAR', group = grp_parsar)

start = input(0.02)
increment = input(0.02)
maximum = input(0.2, "Max Value")
out = ta.sar(start, increment, maximum)
plot(out, "ParabolicSAR", style=plot.style_cross, color=color.new(color.yellow, 30), linewidth = 2, display = display_parsar  ? display.all: display.none)
// -------------------------------- Parabolic SAR --------------------------------

Overview

Ichimoku Cloud signals trend changes via Tenkan-sen and Kijun-sen crosses and places arrows at Kijun-sen direction shifts. Multi-timeframe Kijun-sen support enables higher-timeframe analysis. Key settings adjust conversion periods, base periods, Senkou Span 2 periods, displacement, and toggle visibility of cloud and arrow elements.

Details

Published by

harryguiacorn on GitHub

Code credit

FxCloudTrader, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Trend, Moving averages, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

bollingerbollinger-bandbollinger-bandsichimokuichimoku-cloudichimoku-indicatorpinepinescriptpinescript-guidespinescript-indicators

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Enable Ichimoku Cloudbooltruedisplay_ichimoku
Enable Chikou Spanbooltruedisplay_chikou_span
Enable Chikou Span when Kijun-sen changes directionboolfalsedisplay_chikou_span_filter_by_kijun
Enable Kijun Arrowboolfalsedisplay_kijun_arrow
Enable Tenkan-sen and Kijun-sen crossesbooltruedisplay_tk_cross
Tenkan-Sen (Conversion Line) Periodsint9conversionPeriods
Kijun-Sen (Base Line) Periodsint26basePeriodsK
Senkou Span 2 Periodsint52senkou2Periods
Displacementint26_displacement
Enable Multi Timeframe Kijun-senboolfalsedisplay_mtk
Enablebooltruebool_tf1
Enablebooltruebool_tf2
Show all 28 settings
SettingTypeDefaultVariable
Enablebooltruebool_tf3
Enablebooltruebool_tf4
Timeframe 1timeframe1Dtf_1
Timeframe 2timeframe240tf_2
Timeframe 3timeframe60tf_3
Timeframe 4timeframe15tf_4
ATR Panel positionstringtoptableYposInput
tableXposInputstringrighttableXposInput
Abovecolorcolor.new(color.green, 30)bullColorInput
Undercolorcolor.new(color.red, 30)bearColorInput
Neutralcolorcolor.new(color.gray, 80)neutColorInput
Text Colourcolorcolor.new(color.white, 20)textColour_atrPanel
Enable Parabolic SARboolfalsedisplay_parsar
startfloat0.02start
incrementfloat0.02increment
Max Valuefloat0.2maximum
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

257 stars

This indicator analyzes short-term price action on index futures and options charts by applying Rational Quadratic kernel smoothing to detect sideways consolidation ranges and potential breakouts. It processes pivot highs and lows over customizable loopback pe

Indicator v5 Support & resistanceTrend Repaints
Updated 6 weeks ago · None stated GitHub repository of SPX 30M - Trading Chart

MA Envelope (MAE)

by mihakralj
99 stars

The MA Envelope indicator calculates upper and lower channel bands shifted by a user-defined percentage around a baseline moving average. It supports Simple Moving Average, Exponential Moving Average, and Weighted Moving Average calculation types. The script p

Indicator v6 Moving averagesSupport & resistance
Updated 4 weeks ago · Apache-2.0 GitHub repository of MA Envelope (MAE)
56 stars

This indicator calculates an Exponential Moving Average and a Zero-Lag Moving Average to identify market trends on the price chart. It plots both moving averages and fills the space between them with color to highlight trend direction. Upon a crossover or cros

Indicator v5 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of No-Lag MA Trend Levels
55 stars

Calculates swing points, dynamic support and resistance channels, and a baseline trend moving average directly on the price chart. It identifies structural highs and lows using 10-bar pivot logic, plotting colored triangles offset to confirmed swing bars. Dyna

Indicator v6 Support & resistanceTrend
Updated 6 months ago · Apache-2.0 GitHub repository of Structural Levels & Key Zones

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers