OPEN-SOURCE SCRIPT

Taka Swing Didi Index

121
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © Ltardi

//version=6

// Didi Index script may be freely distributed under the MIT license.
indicator('Taka Swing Didi Index')

curtaLength = input(title = 'Curta (Short) Length', defval = 3)
mediaLength = input(title = 'Media (Medium) Length', defval = 8)
longaLength = input(title = 'Longa (Long) Length', defval = 50)
src = input(title = 'Source', defval = close)
applyFilling = input(title = 'Apply Ribbon Filling ?', defval = true)
highlightCrossovers = input(title = 'Highlight Crossovers ?', defval = true)

media = ta.sma(src, mediaLength)
curta = ta.sma(src, curtaLength) / media
longa = ta.sma(src, longaLength) / media

curtaPlot = plot(curta, title = 'Curta', color = color.rgb(9, 192, 233))
plot(1, title = 'Media', color = color.rgb(230, 124, 11))
longaPlot = plot(longa, title = 'Longa', color = color.rgb(14, 8, 8))

color_1 = color.new(color.white, 100)
fillColor = applyFilling ? curta > longa ? #30e5ef : color.rgb(0, 0, 0) : color_1
fill(curtaPlot, longaPlot, color = fillColor)

avg_1 = math.avg(longa, longa[1])
plotshape(ta.crossover(curta, longa) and highlightCrossovers ? avg_1 : na, title = 'Crossover', location = location.absolute, style = shape.circle, size = size.tiny, color = color.rgb(81, 195, 79))
avg_2 = math.avg(longa, longa[1])
plotshape(ta.crossunder(curta, longa) and highlightCrossovers ? avg_2 : na, title = 'Crossunder', location = location.absolute, style = shape.circle, size = size.tiny, color = color.rgb(255, 76, 76))

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.