KAIRI
"KAIRI RELATIVE INDEX" by KivancOzbilgic, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: KAIRI RELATIVE INDEX (v1.0), read 2026-10-12T16:04:01.000Z; source language v5.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
KAIRI RELATIVE INDEX by KivancOzbilgic, ported from Pine v5. Pane indicator with 4 plots and 5 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KivancOzbilgic
// ------------------------------------------------------------------------------------------------
// Original author: KivancOzbilgic
// Original title: KAIRI RELATIVE INDEX
// Licence: MPL-2.0 (the header above is the original notice, kept verbatim)
// Pine version: 5
// Fetched: 2026-10-12
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=5
indicator('KAIRI', overlay=false, timeframe='')
length = input.int(title='HO Periodu', minval=2, defval=50)
maInput = input.string(title='HO Çeşidi', defval='SMA', options=['SMA', 'EMA', 'WMA', 'TMA', 'VIDYA', 'WWMA', 'ZLEMA', 'TSF', 'HMA', 'VWMA'])
src = input(title='Kaynak Data', defval=close)
ust = input.int(title='Upper % Level', minval=0, defval=10)
alt = input.int(title='Lower % Level', maxval=0, defval=-10)
//VIDYA
valpha = 2 / (length + 1)
vud1 = src > src[1] ? src - src[1] : 0
vdd1 = src < src[1] ? src[1] - src : 0
vUD = math.sum(vud1, 9)
vDD = math.sum(vdd1, 9)
vCMO = (vUD - vDD) / (vUD + vDD)
VIDYA = 0.0
VIDYA := valpha * math.abs(vCMO) * src + (1 - valpha * math.abs(vCMO)) * nz(VIDYA[1])
//WELLES WILDER MOVING AVERAGE
wwalpha = 1 / length
WWMA = 0.0
WWMA := wwalpha * src + (1 - wwalpha) * nz(WWMA[1])
//Zero Lag Mov Avg
zxLag = length / 2 == math.round(length / 2) ? length / 2 : (length - 1) / 2
zxEMAData = src + src - src[zxLag]
ZLEMA = ta.ema(zxEMAData, length)
//Time Series Forecast
lrc = ta.linreg(src, length, 0)
lrc1 = ta.linreg(src, length, 1)
lrs = lrc - lrc1
TSF = ta.linreg(src, length, 0) + lrs
//HULL MOVING AVERAGE
HMA = ta.wma(2 * ta.wma(src, length / 2) - ta.wma(src, length), math.round(math.sqrt(length)))
//VOLUME WEIGHTED MOV AVG
VWMA = math.sum(close * volume, length) / math.sum(volume, length)
getMA(src, length) =>
ma = 0.0
if maInput == 'SMA'
ma := ta.sma(src, length)
ma
if maInput == 'EMA'
ma := ta.ema(src, length)
ma
if maInput == 'WMA'
ma := ta.wma(src, length)
ma
if maInput == 'TMA'
ma := ta.sma(ta.sma(src, math.ceil(length / 2)), math.floor(length / 2) + 1)
ma
if maInput == 'VIDYA'
ma := VIDYA
ma
if maInput == 'WWMA'
ma := WWMA
ma
if maInput == 'ZLEMA'
ma := ZLEMA
ma
if maInput == 'TSF'
ma := TSF
ma
if maInput == 'HMA'
ma := HMA
ma
if maInput == 'VWMA'
ma := VWMA
ma
ma
ALL = getMA(src, length)
plot((src - ALL) * 100 / ALL, color=color.new(color.maroon, 0), linewidth=2, title='KAIRI')
plot(0, title='0')
plot(ust, color=bar_index % 5 == 0 ? #BF003D : #00000000, title='ÜST')
plot(alt, color=bar_index % 5 == 0 ? #00BF3D : #00000000, title='ALT')
This file is under the Mozilla Public License 2.0; it is a port of the original by KivancOzbilgic, with the original licence header kept and the changes made for FloScript noted in the file.
- v2
Library refresh 2026-10-14
- v1
Library refresh 2026-10-12
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.