Multiple OTT
"Multiple OTT" by KivancOzbilgic, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Multiple OTT (v2.0), read 2026-10-12T16:03:38.914Z; 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.
Multiple OTT by KivancOzbilgic, ported from Pine v5. Overlay indicator with 6 plots and 7 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KivancOzbilgic
//developer: ANIL ÖZEKŞİ
//author: @kivancozbilgic
// ------------------------------------------------------------------------------------------------
// Original author: KivancOzbilgic
// Original title: Multiple OTT
// 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('Multiple OTT', 'MOTT', overlay=true, precision=2)
src = input(close, title='Source')
lengthX1 = input.int(80, 'High/Low Period', minval=1)
length = input.int(2, 'OTT Period', minval=1)
percent = input.float(1.4, 'OTT Percent', step=0.1, minval=0)
offset = input.int(3, 'OTT Offsetting length', minval=1)
mav = input.string(title='Moving Average Type', defval='VAR', options=['SMA', 'EMA', 'WMA', 'TMA', 'VAR', 'WWMA', 'ZLEMA', 'TSF'])
showsupport = input(title="Show MOVING AVERAGE?", defval=false)
Var_Func(src, length) =>
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 = nz((vUD - vDD) / (vUD + vDD))
VAR = 0.0
VAR := nz(valpha * math.abs(vCMO) * src) + (1 - valpha * math.abs(vCMO)) * nz(VAR[1])
VAR
VAR = Var_Func(src, length)
Wwma_Func(src, length) =>
wwalpha = 1 / length
WWMA = 0.0
WWMA := wwalpha * src + (1 - wwalpha) * nz(WWMA[1])
WWMA
WWMA = Wwma_Func(src, length)
Zlema_Func(src, length) =>
zxLag = length / 2 == math.round(length / 2) ? length / 2 : (length - 1) / 2
zxEMAData = src + src - src[zxLag]
ZLEMA = ta.ema(zxEMAData, length)
ZLEMA
ZLEMA = Zlema_Func(src, length)
Tsf_Func(src, length) =>
lrc = ta.linreg(src, length, 0)
lrc1 = ta.linreg(src, length, 1)
lrs = lrc - lrc1
TSF = ta.linreg(src, length, 0) + lrs
TSF
TSF = Tsf_Func(src, length)
ma(source, length, _type) =>
switch _type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"WMA" => ta.wma(source, length)
"TMA" => ta.sma(ta.sma(source, math.ceil(length / 2)), math.floor(length / 2) + 1)
"VAR" => Var_Func(source, length)
"VWMA" => ta.vwma(source, length)
"ZLEMA" => Zlema_Func(source, length)
"TSF" => Tsf_Func(source, length)
"SMMA (RMA)" => ta.rma(source, length)
MAvg = ma(src, length, mav)
K1 = ta.highest(high, lengthX1)
K2 = ta.lowest(low, lengthX1)
ott(source, length, percent) =>
MA = ma(source, length, mav)
fark = MA * percent * 0.01
longStop = MA - fark
shortStop = MA + fark
longStop := longStop > nz(longStop[1]) or MA < nz(longStop[1]) ? longStop : nz(longStop[1])
shortStop := shortStop < nz(shortStop[1]) or MA > nz(shortStop[1]) ? shortStop : nz(shortStop[1])
k1 = 0.0
k1 := MA > nz(k1[1]) ? longStop : MA < nz(k1[1]) ? shortStop : nz(k1[1])
ot1 = 1 + percent * 0.01 / 2
ot2 = 1 - percent * 0.01 / 2
k2 = MA > k1 ? k1 * ot1 : k1 * ot2
OT = nz(k2[2])
O1 = ott(K1, length, percent)
O2 = (ott(K1, length, percent) + (ott(K1, length, percent) + ott(K2, length, percent)) / 2) / 2
O3 = (ott(K1, length, percent) + ott(K2, length, percent)) / 2
O4 = (ott(K2, length, percent) + (ott(K1, length, percent) + ott(K2, length, percent)) / 2) / 2
O5 = ott(K2, length, percent)
plot(O1[offset], "OTT", color=color.rgb(33, 170, 243), linewidth=2)
plot(O2[offset], "OTT2", color=color.rgb(33, 170, 243), linewidth=1, style=plot.style_circles)
plot(O3[offset], "OTT3", color=color.rgb(56, 224, 196), linewidth=1, style=plot.style_circles)
plot(O4[offset], "OTT4", color=color.rgb(199, 56, 224), linewidth=1, style=plot.style_circles)
plot(O5[offset], "OTT5", color=color.rgb(199, 56, 224), linewidth=2)
plot(showsupport ? MAvg : na, color=color.new(#051be1, 0), linewidth=2, title="VIDYA")
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.