-
deneme
PHP Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RafaelZioni
//@version=5
indicator(title='SAR', overlay=true)
len85 = input(20)
z(close, len85) =>
h85 = 0.0
d85 = 0.0
for i85 = 0 to len85 - 1 by 1
k85 = (len85 - i85) * len85
h85 += k85
d85 += close[i85] * k85
d85
d85 / h85
c85 = z(close, math.floor(math.sqrt(len85)))
start85 = 0.01
increment85 = 0.01
maximum85 = 0.2
s85 = ta.sar(start85, increment85, maximum85)
s185 = z(s85, len85)
pc85 = close < s185 ? color.red : color.green
plot(s185,"20", style=plot.style_line, color=pc85, linewidth=1)
len856 = input(50)
z1(close, len856) =>
h856 = 0.0
d856 = 0.0
for i856 = 0 to len856 - 1 by 1
k856 = (len856 - i856) * len856
h856 += k856
d856 += close[i856] * k856
d856
d856 / h856
c856 = z1(close, math.floor(math.sqrt(len856)))
start856 = 0.01
increment856 = 0.01
maximum856 = 0.2
s856 = ta.sar(start856, increment856, maximum856)
s1856 = z1(s856, len856)
pc856 = close < s1856 ? color.red : color.aqua
plot(s1856,"50", style=plot.style_line, color=pc856, linewidth=1)
len8567 = input(100)
z11(close, len8567) =>
h8567 = 0.0
d8567 = 0.0
for i8567 = 0 to len8567 - 1 by 1
k8567 = (len8567 - i8567) * len8567
h8567 += k8567
d8567 += close[i8567] * k8567
d8567
d8567 / h8567
c8567 = z11(close, math.floor(math.sqrt(len8567)))
start8567 = 0.01
increment8567 = 0.01
maximum8567 = 0.2
s8567 = ta.sar(start8567, increment8567, maximum8567)
s18567 = z11(s8567, len8567)
pc8567 = close < s18567 ? color.red : color.yellow
plot(s18567,"100", style=plot.style_line, color=pc8567, linewidth=1)
-
deneme
PHP Code:
//@version=5
indicator("**", overlay = true,max_boxes_count=500,max_lines_count=500, format=format.price)
// Custom cosh function
cosh(float x) =>
(math.exp(x) + math.exp(-x)) / 2
// Custom acosh function
acosh(float x) =>
x < 1 ? na : math.log(x + math.sqrt(x * x - 1))
// Custom sinh function
sinh(float x) =>
(math.exp(x) - math.exp(-x)) / 2
// Custom asinh function
asinh(float x) =>
math.log(x + math.sqrt(x * x + 1))
// Custom inverse tangent function
atan(float x) =>
math.pi / 2 - math.atan(1 / x)
// Chebyshev Type I Moving Average
chebyshevI(float src, int len, float ripple) =>
a = 0.
b = 0.
g = 0.
chebyshev = 0.
a := cosh(1 / len * acosh(1 / (1 - ripple)))
b := sinh(1 / len * asinh(1 / ripple))
g := (a - b) / (a + b)
chebyshev := (1 - g) * src + g * nz(chebyshev[1])
chebyshev
bool_to_float(bool source) =>
source ? 1 : 0
ema(source)=>
var float ema = 0.0
var int count = 0
count := nz(count[1]) + 1
ema := (1.0 - 2.0 / (count + 1.0)) * nz(ema[1]) + 2.0 / (count + 1.0) * source
ema
atan2(y, x) =>
var float angle = 0.0
if x > 0
angle := math.atan(y / x)
else
if x < 0 and y >= 0
angle := math.atan(y / x) + math.pi
else
if x < 0 and y < 0
angle := math.atan(y / x) - math.pi
else
if x == 0 and y > 0
angle := math.pi / 2
else
if x == 0 and y < 0
angle := -math.pi / 2
angle
degrees(float source) =>
source * 180 / math.pi
tra()=>
atr = ema(ta.tr)
slope = (close - close[10]) / (atr * 10)
angle_rad = atan2(slope, 1)
degrees = degrees(angle_rad)
source = ta.sma((degrees > 0 ? high : low), 2)
mats(source, length) =>
smooth = 0.
higher_high = math.max(math.sign(ta.change(ta.highest(length))), 0)
lower_low = math.max(math.sign(ta.change(ta.lowest(length)) * -1), 0)
time_constant = math.pow(ta.sma(bool_to_float(higher_high or lower_low), length), 2)
smooth := nz(smooth[1] + time_constant * (source - smooth[1]), source)
wilders_period = length * 4 - 1
atr = math.abs(nz(smooth[1]) - smooth)
ma_atr = ta.ema(atr, wilders_period)
delta_fast_atr = ta.ema(ma_atr, wilders_period) * length * 0.4
result = 0.0
if smooth > nz(result[1])
if smooth - delta_fast_atr < result[1]
result := result[1]
else
result := smooth - delta_fast_atr
else
if smooth + delta_fast_atr > result[1]
result := result[1]
else
result := smooth + delta_fast_atr
// Return
result
length20 = input.int(1, "Length", 1)
up_color = input.color(color.rgb(223, 64, 251, 100), "", inline = "color")
down_color = input.color(color.rgb(223, 64, 251, 100), "", inline = "color")
enable_glow = input.bool(true, "Enable Glow", inline = "color")
mats20 = mats(tra(), length20)
atr20 = ta.atr(length20)
colour20 = ta.sma(close, 1) > mats20 ? up_color : down_color
atr_10 = ema(ta.tr) / 2
alpha = color.new(color.black, 100)
max20 = mats20 + atr_10
min20 = mats20 - atr_10
center20 = plot(mats20, "T0", colour20, style=plot.style_stepline, editable = true)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
//@version=5
start88 = input(0.1, title="start", group="Parabolic SAR")
increment88 = input(0.1, title="Increment", group="Parabolic SAR")
maximum88 = input(0.1, title="Maximum", group="Parabolic SAR")
out88 = ta.sar(start88, increment88, maximum88)
sarChange = ta.change(out88<high)
var prevSar = out88
if(sarChange)
prevSar := out88[1] + ((out88[1]/100)*0.0009)
plot(out88 and sarChange?na:prevSar, style=plot.style_linebr, offset=-1, color=out88<high?color.yellow:color.aqua, title="T1", linewidth=2)
//////////////////////////////////////////////////////////////
length79=(1)
src79=close
start179 = input(0.1)
increment179 = input(0.1)
maximum179 = input(0.1, "Max Value")
out179 = ta.sar(start179, increment179, maximum179)
momo19 = src79 - src79[length79]
smdo19 = out179 - momo19
//plot(smdo19, "S0S", style=plot.style_line, color=color.rgb(229, 77, 243, 100))
plot(smdo19, "T", style=plot.style_line, offset=1, color=smdo19<high?color.lime:color.red, linewidth=1)
////////////////////////////////////////////////////////////
//@version=5
len44 = input.int(2, 'Length', step=1, minval=1)
len45 = input.int(3, 'Length', step=1, minval=1)
len46 = input.int(4, 'Length', step=1, minval=1)
len47 = input.int(5, 'Length', step=1, minval=1)
displace = input.int(0, 'Displace', step=1, minval=0)
ma_type = input.string('SMA', 'MA Type', options=['SMA', 'HMA'])
//Hilo Activator
float hilo = na
hi44 = ta.sma(high, len44)
hi45 = ta.sma(high, len45)
hi46 = ta.sma(high, len46)
hi47 = ta.sma(high, len47)
lo44 = ta.sma(low, len44)
lo45 = ta.sma(low, len45)
lo46 = ta.sma(low, len46)
lo47 = ta.sma(low, len47)
// Hull Moving Average (HMA)
//if ma_type == 'HMA'
//hi := ta.wma(2 * ta.wma(high, len44 / 2) - ta.wma(high, len44), math.round(math.sqrt(len44)))
//lo := ta.wma(2 * ta.wma(low, len44 / 2) - ta.wma(low, len44), math.round(math.sqrt(len44)))
hilo := close > hi44[displace] ? 1 : close < lo44[displace] ? -1 : hilo[1]
hilo := close > hi45[displace] ? 1 : close < lo45[displace] ? -1 : hilo[1]
hilo := close > hi46[displace] ? 1 : close < lo46[displace] ? -1 : hilo[1]
hilo := close > hi47[displace] ? 1 : close < lo47[displace] ? -1 : hilo[1]
ghla44 = hilo == -1 ? hi44[displace] : lo44[displace]
ghla45 = hilo == -1 ? hi45[displace] : lo45[displace]
ghla46 = hilo == -1 ? hi46[displace] : lo46[displace]
ghla47 = hilo == -1 ? hi47[displace] : lo47[displace]
color44 = hilo == -1 ? color.red : color.lime
//Alerts
//buyCondition = hilo == 1 and hilo[1] == -1
//sellCondition = hilo == -1 and hilo[1] == 1
//if buyCondition
//alert('Long', alert.freq_once_per_bar)
//if sellCondition
//alert('Short', alert.freq_once_per_bar)
//Plots
plot(ghla44, "T2", color=color44, style=plot.style_cross, linewidth = 1)
plot(ghla45, "T3", color=color44, style=plot.style_cross, linewidth = 1)
plot(ghla46, "T4", color=color44, style=plot.style_cross, linewidth = 1)
plot(ghla47, "T5", color=color44, style=plot.style_cross, linewidth = 1)
//plotshape(buyCondition, title = "Long", color = color.lime, textcolor = color.lime, text = "Long", style = shape.triangleup, location = location.belowbar, size = size.small)
//plotshape(sellCondition, title = "Short", color = color.red, textcolor = color.red, text = "Short", style = shape.triangledown, location = location.abovebar, size = size.small)
////////////////////////////////////////
//@version=5
grp_CS = "Candlesticks"
showRanging = input(true, title="Color consolidation candles", group=grp_CS, tooltip="Determined by the Range Filter settings as ranging/consolidating mid-range")
allCandleColor = input(true, title="Color trending candles", group=grp_CS, tooltip="Determined by the Range Filter settings as not ranging/consolidating")
grp_MAIN = "General"
showRF = input(false, title="Show Range Filter", group=grp_MAIN)
showRFBands = input(false, title="Show Range Filter bands", group=grp_MAIN)
// Color variables
grp_THEME = "Theme"
upColor = input.color(color.rgb(0, 225, 255), title="Bullish*", group=grp_THEME, tooltip="This will be applied to entry candles, the Range Filter, and the Hull ribbon. These are not always technically bullish candles, but rather derive their logic from the Range Filter bar coloring instead of OHLC values.")
downColor = input.color(color.rgb(226, 2, 107), title="Bearish*", group=grp_THEME, tooltip="This will be applied to entry candles, the Range Filter, and the Hull ribbon. These are not always technically bearish candles, but rather derive their logic from the Range Filter bar coloring instead of OHLC values.")
midColor = input.color(color.orange, title="Consolidation candle", group=grp_THEME, tooltip="Determined by the Range Filter settings as ranging")
//=Range Filter
//==================================================================================================================================
grp_RF = "Range Filter"
src = input(defval=hl2, title="Source", group=grp_RF)
per = input.int(defval=27, minval=1, title="Sampling Period", group=grp_RF)
mult = input.float(defval=2.7, minval=0.1, title="Range Multiplier", group=grp_RF)
// Smooth Average Range
smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x[1]), t)
smoothrng = ta.ema(avrng, wper) * m
smoothrng
smrng = smoothrng(src, per, mult)
// Range Filter
rngfilt(x, r) =>
rngfilt = x
rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r :
x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r
rngfilt
filt = rngfilt(src, smrng)
// Filter Direction
upward = 0.0
upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1])
downward = 0.0
downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 : nz(downward[1])
// Colors
filtcolor = upward > 0 ? upColor : downward > 0 ? downColor : midColor
barcolor = src > filt and src > src[1] and upward > 0 ? (allCandleColor ? upColor : na) :
src > filt and src < src[1] and upward > 0 ? (allCandleColor ? upColor : na) :
src < filt and src < src[1] and downward > 0 ? (allCandleColor ? downColor : na) :
src < filt and src > src[1] and downward > 0 ? (allCandleColor ? downColor : na) : (showRanging ? midColor : na)
isUpColor = src > filt and src > src[1] and upward > 0 ? true :
src > filt and src < src[1] and upward > 0 ? true : false
isDownColor = src < filt and src < src[1] and downward > 0 ? true :
src < filt and src > src[1] and downward > 0 ? true : false
isOrange = src > filt and src > src[1] and upward > 0 ? na :
src > filt and src < src[1] and upward > 0 ? na :
src < filt and src < src[1] and downward > 0 ? na :
src < filt and src > src[1] and downward > 0 ? na : true
//filtplot = plot(filt, color=filtcolor, linewidth=1, title="Range Filter", display=(showRF ? display.all : display.none))
barcolor(barcolor)
//////////////////////////
///////////////////////
-
https://www.tradingview.com/x/VbX0EO4Y/
sanırım tavanı hayırlı olsun diyeceğiz....
-
yedeklemeler....temmuz 2023...
PHP Code:
//@version=5
indicator("**", overlay = true,max_boxes_count=500,max_lines_count=500, format=format.price)
// Custom cosh function
cosh(float x) =>
(math.exp(x) + math.exp(-x)) / 2
// Custom acosh function
acosh(float x) =>
x < 1 ? na : math.log(x + math.sqrt(x * x - 1))
// Custom sinh function
sinh(float x) =>
(math.exp(x) - math.exp(-x)) / 2
// Custom asinh function
asinh(float x) =>
math.log(x + math.sqrt(x * x + 1))
// Custom inverse tangent function
atan(float x) =>
math.pi / 2 - math.atan(1 / x)
// Chebyshev Type I Moving Average
chebyshevI(float src, int len, float ripple) =>
a = 0.
b = 0.
g = 0.
chebyshev = 0.
a := cosh(1 / len * acosh(1 / (1 - ripple)))
b := sinh(1 / len * asinh(1 / ripple))
g := (a - b) / (a + b)
chebyshev := (1 - g) * src + g * nz(chebyshev[1])
chebyshev
bool_to_float(bool source) =>
source ? 1 : 0
ema(source)=>
var float ema = 0.0
var int count = 0
count := nz(count[1]) + 1
ema := (1.0 - 2.0 / (count + 1.0)) * nz(ema[1]) + 2.0 / (count + 1.0) * source
ema
atan2(y, x) =>
var float angle = 0.0
if x > 0
angle := math.atan(y / x)
else
if x < 0 and y >= 0
angle := math.atan(y / x) + math.pi
else
if x < 0 and y < 0
angle := math.atan(y / x) - math.pi
else
if x == 0 and y > 0
angle := math.pi / 2
else
if x == 0 and y < 0
angle := -math.pi / 2
angle
degrees(float source) =>
source * 180 / math.pi
tra()=>
atr = ema(ta.tr)
slope = (close - close[10]) / (atr * 10)
angle_rad = atan2(slope, 1)
degrees = degrees(angle_rad)
source = ta.sma((degrees > 0 ? high : low), 2)
mats(source, length) =>
smooth = 0.
higher_high = math.max(math.sign(ta.change(ta.highest(length))), 0)
lower_low = math.max(math.sign(ta.change(ta.lowest(length)) * -1), 0)
time_constant = math.pow(ta.sma(bool_to_float(higher_high or lower_low), length), 2)
smooth := nz(smooth[1] + time_constant * (source - smooth[1]), source)
wilders_period = length * 4 - 1
atr = math.abs(nz(smooth[1]) - smooth)
ma_atr = ta.ema(atr, wilders_period)
delta_fast_atr = ta.ema(ma_atr, wilders_period) * length * 0.4
result = 0.0
if smooth > nz(result[1])
if smooth - delta_fast_atr < result[1]
result := result[1]
else
result := smooth - delta_fast_atr
else
if smooth + delta_fast_atr > result[1]
result := result[1]
else
result := smooth + delta_fast_atr
// Return
result
length20 = input.int(1, "Length", 1)
up_color = input.color(color.rgb(223, 64, 251, 100), "", inline = "color")
down_color = input.color(color.rgb(223, 64, 251, 100), "", inline = "color")
enable_glow = input.bool(true, "Enable Glow", inline = "color")
mats20 = mats(tra(), length20)
atr20 = ta.atr(length20)
colour20 = ta.sma(close, 1) > mats20 ? up_color : down_color
atr_10 = ema(ta.tr) / 2
alpha = color.new(color.black, 100)
max20 = mats20 + atr_10
min20 = mats20 - atr_10
center20 = plot(mats20, "T0", colour20, style=plot.style_stepline, editable = true)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
//@version=5
start88 = input(0.1, title="start", group="Parabolic SAR")
increment88 = input(0.1, title="Increment", group="Parabolic SAR")
maximum88 = input(0.1, title="Maximum", group="Parabolic SAR")
out88 = ta.sar(start88, increment88, maximum88)
sarChange = ta.change(out88<high)
var prevSar = out88
if(sarChange)
prevSar := out88[1] + ((out88[1]/100)*0.0009)
plot(out88 and sarChange?na:prevSar, style=plot.style_linebr, offset=-1, color=out88<high?color.yellow:color.aqua, title="T1", linewidth=2)
//////////////////////////////////////////////////////////////
length79=(1)
src79=close
start179 = input(0.1)
increment179 = input(0.1)
maximum179 = input(0.1, "Max Value")
out179 = ta.sar(start179, increment179, maximum179)
momo19 = src79 - src79[length79]
smdo19 = out179 - momo19
//plot(smdo19, "S0S", style=plot.style_line, color=color.rgb(229, 77, 243, 100))
plot(smdo19, "T", style=plot.style_line, offset=1, color=smdo19<high?color.lime:color.red, linewidth=1)
////////////////////////////////////////////////////////////
//@version=5
len44 = input.int(2, 'Length', step=1, minval=1)
len45 = input.int(3, 'Length', step=1, minval=1)
len46 = input.int(4, 'Length', step=1, minval=1)
len47 = input.int(5, 'Length', step=1, minval=1)
displace = input.int(0, 'Displace', step=1, minval=0)
ma_type = input.string('SMA', 'MA Type', options=['SMA', 'HMA'])
//Hilo Activator
float hilo = na
hi44 = ta.sma(high, len44)
hi45 = ta.sma(high, len45)
hi46 = ta.sma(high, len46)
hi47 = ta.sma(high, len47)
lo44 = ta.sma(low, len44)
lo45 = ta.sma(low, len45)
lo46 = ta.sma(low, len46)
lo47 = ta.sma(low, len47)
// Hull Moving Average (HMA)
//if ma_type == 'HMA'
//hi := ta.wma(2 * ta.wma(high, len44 / 2) - ta.wma(high, len44), math.round(math.sqrt(len44)))
//lo := ta.wma(2 * ta.wma(low, len44 / 2) - ta.wma(low, len44), math.round(math.sqrt(len44)))
hilo := close > hi44[displace] ? 1 : close < lo44[displace] ? -1 : hilo[1]
hilo := close > hi45[displace] ? 1 : close < lo45[displace] ? -1 : hilo[1]
hilo := close > hi46[displace] ? 1 : close < lo46[displace] ? -1 : hilo[1]
hilo := close > hi47[displace] ? 1 : close < lo47[displace] ? -1 : hilo[1]
ghla44 = hilo == -1 ? hi44[displace] : lo44[displace]
ghla45 = hilo == -1 ? hi45[displace] : lo45[displace]
ghla46 = hilo == -1 ? hi46[displace] : lo46[displace]
ghla47 = hilo == -1 ? hi47[displace] : lo47[displace]
color44 = hilo == -1 ? color.red : color.lime
//Alerts
//buyCondition = hilo == 1 and hilo[1] == -1
//sellCondition = hilo == -1 and hilo[1] == 1
//if buyCondition
//alert('Long', alert.freq_once_per_bar)
//if sellCondition
//alert('Short', alert.freq_once_per_bar)
//Plots
plot(ghla44, "T2", color=color44, style=plot.style_cross, linewidth = 1)
plot(ghla45, "T3", color=color44, style=plot.style_cross, linewidth = 1)
plot(ghla46, "T4", color=color44, style=plot.style_cross, linewidth = 1)
plot(ghla47, "T5", color=color44, style=plot.style_cross, linewidth = 1)
//plotshape(buyCondition, title = "Long", color = color.lime, textcolor = color.lime, text = "Long", style = shape.triangleup, location = location.belowbar, size = size.small)
//plotshape(sellCondition, title = "Short", color = color.red, textcolor = color.red, text = "Short", style = shape.triangledown, location = location.abovebar, size = size.small)
////////////////////////////////////////
//@version=5
grp_CS = "Candlesticks"
showRanging = input(true, title="Color consolidation candles", group=grp_CS, tooltip="Determined by the Range Filter settings as ranging/consolidating mid-range")
allCandleColor = input(true, title="Color trending candles", group=grp_CS, tooltip="Determined by the Range Filter settings as not ranging/consolidating")
grp_MAIN = "General"
showRF = input(false, title="Show Range Filter", group=grp_MAIN)
showRFBands = input(false, title="Show Range Filter bands", group=grp_MAIN)
// Color variables
grp_THEME = "Theme"
upColor = input.color(color.rgb(0, 225, 255), title="Bullish*", group=grp_THEME, tooltip="This will be applied to entry candles, the Range Filter, and the Hull ribbon. These are not always technically bullish candles, but rather derive their logic from the Range Filter bar coloring instead of OHLC values.")
downColor = input.color(color.rgb(226, 2, 107), title="Bearish*", group=grp_THEME, tooltip="This will be applied to entry candles, the Range Filter, and the Hull ribbon. These are not always technically bearish candles, but rather derive their logic from the Range Filter bar coloring instead of OHLC values.")
midColor = input.color(color.orange, title="Consolidation candle", group=grp_THEME, tooltip="Determined by the Range Filter settings as ranging")
//=Range Filter
//==================================================================================================================================
grp_RF = "Range Filter"
src = input(defval=hl2, title="Source", group=grp_RF)
per = input.int(defval=27, minval=1, title="Sampling Period", group=grp_RF)
mult = input.float(defval=2.7, minval=0.1, title="Range Multiplier", group=grp_RF)
// Smooth Average Range
smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x[1]), t)
smoothrng = ta.ema(avrng, wper) * m
smoothrng
smrng = smoothrng(src, per, mult)
// Range Filter
rngfilt(x, r) =>
rngfilt = x
rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r :
x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r
rngfilt
filt = rngfilt(src, smrng)
// Filter Direction
upward = 0.0
upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1])
downward = 0.0
downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 : nz(downward[1])
// Colors
filtcolor = upward > 0 ? upColor : downward > 0 ? downColor : midColor
barcolor = src > filt and src > src[1] and upward > 0 ? (allCandleColor ? upColor : na) :
src > filt and src < src[1] and upward > 0 ? (allCandleColor ? upColor : na) :
src < filt and src < src[1] and downward > 0 ? (allCandleColor ? downColor : na) :
src < filt and src > src[1] and downward > 0 ? (allCandleColor ? downColor : na) : (showRanging ? midColor : na)
isUpColor = src > filt and src > src[1] and upward > 0 ? true :
src > filt and src < src[1] and upward > 0 ? true : false
isDownColor = src < filt and src < src[1] and downward > 0 ? true :
src < filt and src > src[1] and downward > 0 ? true : false
isOrange = src > filt and src > src[1] and upward > 0 ? na :
src > filt and src < src[1] and upward > 0 ? na :
src < filt and src < src[1] and downward > 0 ? na :
src < filt and src > src[1] and downward > 0 ? na : true
//filtplot = plot(filt, color=filtcolor, linewidth=1, title="Range Filter", display=(showRF ? display.all : display.none))
barcolor(barcolor)
//////////////////////////
///////////////////////
-
döngüleme denemesi....
PHP Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © carefulCode53358
//@version=5
indicator(".", overlay = true, max_boxes_count = 100)
////////////////////////////////
start1 = input(0)
increment1 = input(0.1)
maximum1 = input(1, "Max Value")
out1 = ta.sar(start1, increment1, maximum1)
plot(out1, "KısaDöngü", style=plot.style_line, color=#f0ce0e)
/////////////////////////////////
start2 = input(0)
increment2 = input(0.1)
maximum2 = input(0.1, "Max Value")
out2 = ta.sar(start2, increment2, maximum2)
plot(out2, "OrtaDöngü", style=plot.style_line, color=#06deee)
///////////////////////////////////
start21 = input(0)
increment21 = input(0.01)
maximum21 = input(0.1, "Max Value")
out21 = ta.sar(start21, increment21, maximum21)
plot(out21, "UzunDöngü", style=plot.style_line, color=#f2f3f7)
/////////////////////////////////
start213 = input(0.1)
increment213 = input(0.1)
maximum213 = input(1, "Max Value")
out213 = ta.sar(start213, increment213, maximum213)
plot(out213, "KıyasDöngü", style=plot.style_line, color=#c20bf0)
-
PHP Code:
//@version=5
indicator("**", overlay = true,max_boxes_count=500,max_lines_count=500)
color greencolor = #2DD204
color redcolor = #D2042D
int Maxncomp = 5
int MaxLag = 20
int MaxArrayLength = 100
// Calculation of the function Sn, needed to calculate the eigenvalues
// Negative determinants are counted there
gaussSn(matrix<float> A, float l, int n)=>
array<float> w = array.new<float>(n, 0)
matrix<float> B = matrix.copy(A)
int count = 0
int cp = 0
float c = 0.
float s1 = 0.
float s2 = 0.
for i = 0 to n - 1
matrix.set(B, i, i, matrix.get(B, i, i) - l)
for k = 0 to n - 2
for i = k + 1 to n - 1
if matrix.get(B, k, k) == 0
for i1 = 0 to n - 1
array.set(w, i1, matrix.get(B, i1, k))
matrix.set(B, i1, k, matrix.get(B, i1, k + 1))
matrix.set(B, i1, k + 1, array.get(w, i1))
cp := cp + 1
c := matrix.get(B, i, k) / matrix.get(B, k, k)
for j = 0 to n - 1
matrix.set(B, i, j, matrix.get(B, i, j) - matrix.get(B, k, j) * c)
count := 0
s1 := 1
for i = 0 to n - 1
s2 := matrix.get(B, i, i)
if s2 < 0
count := count + 1
count
// Calculation of eigenvalues by the bisection method}
// The good thing is that as many eigenvalues are needed, so many will count,
// saves a lot of resources
gaussbisectionl(matrix<float> A, int k, int n)=>
float e1 = 0.
float maxnorm = 0.
float cn = 0.
float a1 = 0.
float b1 = 0.
float c = 0.
for i = 0 to n - 1
cn := 0
for j = 0 to n - 1
cn := cn + matrix.get(A, i, i)
if maxnorm < cn
maxnorm := cn
a1 := 0
b1 := 10 * maxnorm
e1 := 1.0 * maxnorm / 10000000
while math.abs(b1 - a1) > e1
c := 1.0 * (a1 + b1) / 2
if gaussSn(A, c, n) < k
a1 := c
else
b1 := c
float out = (a1 + b1) / 2.0
out
// Calculates eigenvectors for already computed eigenvalues
svector(matrix<float> A, float l, int n, array<float> V)=>
int cp = 0
matrix<float> B = matrix.copy(A)
float c = 0
array<float> w = array.new<float>(n, 0)
for i = 0 to n - 1
matrix.set(B, i, i, matrix.get(B, i, i) - l)
for k = 0 to n - 2
for i = k + 1 to n - 1
if matrix.get(B, k, k) == 0
for i1 = 0 to n - 1
array.set(w, i1, matrix.get(B, i1, k))
matrix.set(B, i1, k, matrix.get(B, i1, k + 1))
matrix.set(B, i1, k + 1, array.get(w, i1))
cp += 1
c := 1.0 * matrix.get(B, i, k) / matrix.get(B, k, k)
for j = 0 to n - 1
matrix.set(B, i, j, matrix.get(B, i, j) - matrix.get(B, k, j) * c)
array.set(V, n - 1, 1)
c := 1
for i = n - 2 to 0
array.set(V, i, 0)
for j = i to n - 1
array.set(V, i, array.get(V, i) - matrix.get(B, i, j) * array.get(V, j))
array.set(V, i, array.get(V, i) / matrix.get(B, i, i))
c += math.pow(array.get(V, i), 2)
for i = 0 to n - 1
array.set(V, i, array.get(V, i) / math.sqrt(c))
// Fast Singular SSA - "Caterpillar" method
// X-vector of the original series
// n-length
// l-lag length
// s-number of eigencomponents
// (there the original series is divided into components, and then restored, here you set how many components you need)
// Y - the restored row (smoothed by the caterpillar)
fastsingular(array<float> X, int n1, int l1, int s1)=>
int n = math.min(MaxArrayLength, n1)
int l = math.min(MaxLag, l1)
int s = math.min(Maxncomp, s1)
matrix<float> A = matrix.new<float>(l, l, 0.)
matrix<float> B = matrix.new<float>(n, l, 0.)
matrix<float> Bn = matrix.new<float>(l, n, 0.)
matrix<float> V = matrix.new<float>(l, n, 0.)
matrix<float> Yn = matrix.new<float>(l, n, 0.)
var array<float> vtarr = array.new<float>(l, 0.)
array<float> ls = array.new<float>(MaxLag, 0)
array<float> Vtemp = array.new<float>(MaxLag, 0)
array<float> Y = array.new<float>(n, 0)
int k = n - l + 1
// We form matrix A in the method that I downloaded from the site of the creators of this matrix S
for i = 0 to l - 1
for j = 0 to l - 1
matrix.set(A, i, j, 0)
for m = 0 to k - 1
matrix.set(A, i, j, matrix.get(A, i, j) + array.get(X, i + m) * array.get(X, m + j))
matrix.set(B, m, j, array.get(X, m + j))
//Find the eigenvalues and vectors of the matrix A
for i = 0 to s - 1
array.set(ls, i, gaussbisectionl(A, l - i, l))
svector(A, array.get(ls, i), l, Vtemp)
for j = 0 to l - 1
matrix.set(V, i, j, array.get(Vtemp, j))
// The restored matrix is formed
for i1 = 0 to s - 1
for i = 0 to k - 1
matrix.set(Yn, i1, i, 0)
for j = 0 to l - 1
matrix.set(Yn, i1, i, matrix.get(Yn, i1, i) + matrix.get(B, i, j) * matrix.get(V, i1, j))
for i = 0 to l - 1
for j = 0 to k - 1
matrix.set(Bn, i, j, matrix.get(V, i1, i) * matrix.get(Yn, i1, j))
//Diagonal averaging (series recovery)
int kb = k
int lb = l
for i = 0 to n - 1
matrix.set(Yn, i1, i, 0)
if i < lb - 1
for j = 0 to i
if l <= k
matrix.set(Yn, i1, i, matrix.get(Yn, i1, i) + matrix.get(Bn, j, i - j))
if l > k
matrix.set(Yn, i1, i, matrix.get(Yn, i1, i) + matrix.get(Bn, i - j, j))
matrix.set(Yn, i1, i, matrix.get(Yn, i1, i) / (1.0 * (i + 1)))
if (lb - 1 <= i) and (i < kb - 1)
for j = 0 to lb - 1
if l <= k
matrix.set(Yn, i1, i, matrix.get(Yn, i1, i) + matrix.get(Bn, j, i - j))
if l > k
matrix.set(Yn, i1, i, matrix.get(Yn, i1, i) + matrix.get(Bn, i - j, j))
matrix.set(Yn, i1, i, matrix.get(Yn, i1, i) / (1.0 * lb))
if kb - 1 <= i
for j = i - kb + 1 to n - kb
if l <= k
matrix.set(Yn, i1, i, matrix.get(Yn, i1, i) + matrix.get(Bn, j, i - j))
if l > k
matrix.set(Yn, i1, i, matrix.get(Yn, i1, i) + matrix.get(Bn, i - j, j))
matrix.set(Yn, i1, i, matrix.get(Yn, i1, i) / (1.0 * (n - i)))
// Here, if not summarized, then there will be separate decomposition components
// process by own functions
for i = 0 to n - 1
array.set(Y, i, 0)
for i1 = 0 to s - 1
array.set(Y, i, array.get(Y, i) + matrix.get(Yn, i1, i))
Y
float src = input.source(close, "Source", group = "Basic Settings")
int lag = input.int(10, "Lag", group = "Basic Settings")
int ncomp = input.int(2, "Number of Computations", group = "Basic Settings")
int ssapernorm = input.int(20, "SSA Period Normalization", group = "Basic Settings")
int numbars = input.int(33, "Number of Bars", group = "Basic Settings")
int backbars = input.int(40, "Number of Bars to Render", group = "Basic Settings", tooltip ="How many bars to plot.The higher the number the slower the computation.")
bool colorbars = input.bool(true, "Color bars?", group = "UI Options")
bool showSigs = input.bool(false, "Show signals?", group = "UI Options")
float out = 0.
float sig = 0.
float[] srcVal = array.new_float(numbars + 1, 0)
if last_bar_index - bar_index < backbars
for i = 0 to numbars - 1
array.set(srcVal, i, nz(src[i]))
float[] pv = fastsingular(srcVal, numbars, lag, ncomp)
out := array.get(pv, 0)
sig := out[1]
color colorout = out > sig ? greencolor : redcolor
bool goLong = ta.crossover(out, sig)
bool goShort = ta.crossunder(out, sig)
plot(last_bar_index - bar_index < backbars ? out : na, "TR", color = colorout, linewidth = 1)
barcolor(last_bar_index - bar_index < backbars and colorbars ? colorout : na)
//@version=5
// Custom cosh function
cosh(float x) =>
(math.exp(x) + math.exp(-x)) / 2
// Custom acosh function
acosh(float x) =>
x < 1 ? na : math.log(x + math.sqrt(x * x - 1))
// Custom sinh function
sinh(float x) =>
(math.exp(x) - math.exp(-x)) / 2
// Custom asinh function
asinh(float x) =>
math.log(x + math.sqrt(x * x + 1))
// Custom inverse tangent function
atan(float x) =>
math.pi / 2 - math.atan(1 / x)
// Chebyshev Type I Moving Average
chebyshevI(float src, int len, float ripple) =>
a = 0.
b = 0.
g = 0.
chebyshev = 0.
a := cosh(1 / len * acosh(1 / (1 - ripple)))
b := sinh(1 / len * asinh(1 / ripple))
g := (a - b) / (a + b)
chebyshev := (1 - g) * src + g * nz(chebyshev[1])
chebyshev
bool_to_float(bool source) =>
source ? 1 : 0
ema(source)=>
var float ema = 0.0
var int count = 0
count := nz(count[1]) + 1
ema := (1.0 - 2.0 / (count + 1.0)) * nz(ema[1]) + 2.0 / (count + 1.0) * source
ema
atan2(y, x) =>
var float angle = 0.0
if x > 0
angle := math.atan(y / x)
else
if x < 0 and y >= 0
angle := math.atan(y / x) + math.pi
else
if x < 0 and y < 0
angle := math.atan(y / x) - math.pi
else
if x == 0 and y > 0
angle := math.pi / 2
else
if x == 0 and y < 0
angle := -math.pi / 2
angle
degrees(float source) =>
source * 180 / math.pi
tra()=>
atr = ema(ta.tr)
slope = (close - close[10]) / (atr * 10)
angle_rad = atan2(slope, 1)
degrees = degrees(angle_rad)
source = ta.sma((degrees > 0 ? high : low), 2)
mats(source, length) =>
smooth = 0.
higher_high = math.max(math.sign(ta.change(ta.highest(length))), 0)
lower_low = math.max(math.sign(ta.change(ta.lowest(length)) * -1), 0)
time_constant = math.pow(ta.sma(bool_to_float(higher_high or lower_low), length), 2)
smooth := nz(smooth[1] + time_constant * (source - smooth[1]), source)
wilders_period = length * 4 - 1
atr = math.abs(nz(smooth[1]) - smooth)
ma_atr = ta.ema(atr, wilders_period)
delta_fast_atr = ta.ema(ma_atr, wilders_period) * length * 0.4
result = 0.0
if smooth > nz(result[1])
if smooth - delta_fast_atr < result[1]
result := result[1]
else
result := smooth - delta_fast_atr
else
if smooth + delta_fast_atr > result[1]
result := result[1]
else
result := smooth + delta_fast_atr
// Return
result
length = input.int(2, "Length", 2)
up_color = input.color(color.lime, "", inline = "color")
down_color = input.color(color.red, "", inline = "color")
enable_glow = input.bool(true, "Enable Glow", inline = "color")
mats = mats(tra(), length)
atr = ta.atr(length)
colour = ta.sma(close, 2) > mats ? up_color : down_color
atr_10 = ema(ta.tr) / 2
alpha = color.new(color.black, 100)
max = mats + atr_10
min = mats - atr_10
center = plot(mats, "TS", colour, editable = true)
-
deneme..
etiketli döngü....
PHP Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © carefulCode53358
//@version=5
indicator("*", overlay = true, max_lines_count = 100, max_labels_count = 100, format=format.price)
start1 = input.float(title='Start', defval=0.1, step=0.1)
increment1 = input.float(title='Increment', defval=0.1, step=0.1)
maximum1 = input.float(title='Max Value', defval=1, step=0.1)
putlabel1 = input(title='Put Labels', defval=true)
colup1 = input.color(title='Colors', defval=color.rgb(0, 230, 119, 100), inline='col')
coldn1 = input.color(title='', defval=color.rgb(255, 82, 82, 100), inline='col')
int trend1 = 0
float sar1 = 0.0
float ep1 = 0.0
float af1 = 0.0
trend1 := nz(trend1[1])
ep1 := nz(ep1[1])
af1 := nz(af1[1])
sar1 := sar1[1]
if trend1 == 0 and not na(high[1])
trend1 := high >= high[1] or low >= low[1] ? 1 : -1
sar1 := trend1 > 0 ? low[1] : high[1]
ep1 := trend1 > 0 ? high[1] : low[1]
af1 := start1
af1
else
nextsar1 = sar1
if trend1 > 0
if high[1] > ep1
ep1 := high[1]
af1 := math.min(maximum1, af1 + increment1)
af1
nextsar1 := sar1 + af1 * (ep1 - sar1)
nextsar1 := math.min(math.min(low[1], low[2]), nextsar1)
//Reversal
if nextsar1 > low
trend1 := -1
nextsar1 := ep1
ep1 := low
af1 := start1
af1
else
if low[1] < ep1
ep1 := low[1]
af1 := math.min(maximum1, af1 + increment1)
af1
nextsar1 := sar1 + af1 * (ep1 - sar1)
nextsar1 := math.max(math.max(high[1], high[2]), nextsar1)
//Reversal
if nextsar1 < high
trend1 := 1
nextsar1 := ep1
ep1 := high
af1 := start1
af1
sar1 := nextsar1
sar1
plot(sar1, title='2.Döngü', color=trend1 > 0 ? colup1 : coldn1, linewidth=1, style=plot.style_line)
if ta.change(trend1) > 0 and putlabel1
label.new(bar_index, sar1, text=str.tostring(math.round_to_mintick(sar1)), color=colup1, style=label.style_none, size=size.small, textcolor = color.lime)
if ta.change(trend1) < 0 and putlabel1
label.new(bar_index, sar1, text=str.tostring(math.round_to_mintick(sar1)), color=coldn1, style=label.style_none, size=size.small, textcolor = color.red)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
start12 = input.float(title='Start', defval=0, step=0.1)
increment12 = input.float(title='Increment', defval=0.1, step=0.1)
maximum12 = input.float(title='Max Value', defval=1, step=0.1)
putlabel12 = input(title='Put Labels', defval=true)
colup12 = input.color(title='Colors', defval=color.rgb(0, 230, 119, 100), inline='col')
coldn12 = input.color(title='', defval=color.rgb(255, 82, 82, 100), inline='col')
int trend12 = 0
float sar12 = 0.0
float ep12 = 0.0
float af12 = 0.0
trend12 := nz(trend12[1])
ep12 := nz(ep12[1])
af12 := nz(af12[1])
sar12 := sar12[1]
if trend12 == 0 and not na(high[1])
trend12 := high >= high[1] or low >= low[1] ? 1 : -1
sar12 := trend12 > 0 ? low[1] : high[1]
ep12 := trend12 > 0 ? high[1] : low[1]
af12 := start12
af12
else
nextsar12 = sar12
if trend12 > 0
if high[1] > ep12
ep12 := high[1]
af12 := math.min(maximum12, af12 + increment12)
af12
nextsar12 := sar12 + af12 * (ep12 - sar12)
nextsar12 := math.min(math.min(low[1], low[2]), nextsar12)
//Reversal
if nextsar12 > low
trend12 := -1
nextsar12 := ep12
ep12 := low
af12 := start12
af12
else
if low[1] < ep12
ep12 := low[1]
af12 := math.min(maximum12, af12 + increment12)
af12
nextsar12 := sar12 + af12 * (ep12 - sar12)
nextsar12 := math.max(math.max(high[1], high[2]), nextsar12)
//Reversal
if nextsar12 < high
trend12 := 1
nextsar12 := ep12
ep12 := high
af12 := start12
af12
sar12 := nextsar12
sar12
plot(sar12, title='3.Döngü', color=trend12 > 0 ? colup12 : coldn12, linewidth=1, style=plot.style_line)
if ta.change(trend12) > 0 and putlabel12
label.new(bar_index, sar12, text=str.tostring(math.round_to_mintick(sar12)), color=colup12, style=label.style_label_up, size=size.small, textcolor = color.lime)
if ta.change(trend12) < 0 and putlabel12
label.new(bar_index, sar12, text=str.tostring(math.round_to_mintick(sar12)), color=coldn12, style=label.style_label_down, size=size.small, textcolor = color.red)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
start123 = input.float(title='Start', defval=0, step=0.1)
increment123 = input.float(title='Increment', defval=0.1, step=0.1)
maximum123 = input.float(title='Max Value', defval=0.1, step=0.1)
putlabel123 = input(title='Put Labels', defval=true)
colup123 = input.color(title='Colors', defval=color.rgb(0, 230, 119, 100), inline='col')
coldn123 = input.color(title='', defval=color.rgb(255, 82, 82, 100), inline='col')
int trend123 = 0
float sar123 = 0.0
float ep123 = 0.0
float af123 = 0.0
trend123 := nz(trend123[1])
ep123 := nz(ep123[1])
af123 := nz(af123[1])
sar123 := sar123[1]
if trend123 == 0 and not na(high[1])
trend123 := high >= high[1] or low >= low[1] ? 1 : -1
sar123 := trend123 > 0 ? low[1] : high[1]
ep123 := trend123 > 0 ? high[1] : low[1]
af123 := start123
af123
else
nextsar123 = sar123
if trend123 > 0
if high[1] > ep123
ep123 := high[1]
af123 := math.min(maximum123, af123 + increment123)
af123
nextsar123 := sar123 + af123 * (ep123 - sar123)
nextsar123 := math.min(math.min(low[1], low[2]), nextsar123)
//Reversal
if nextsar123 > low
trend123 := -1
nextsar123 := ep123
ep123 := low
af123 := start123
af123
else
if low[1] < ep123
ep123 := low[1]
af123 := math.min(maximum123, af123 + increment123)
af123
nextsar123 := sar123 + af123 * (ep123 - sar123)
nextsar123 := math.max(math.max(high[1], high[2]), nextsar123)
//Reversal
if nextsar123 < high
trend123 := 1
nextsar123 := ep123
ep123 := high
af123 := start123
af123
sar123 := nextsar123
sar123
plot(sar123, title='4.Döngü', color=trend123 > 0 ? colup123 : coldn123, linewidth=1, style=plot.style_line)
if ta.change(trend123) > 0 and putlabel123
label.new(bar_index, sar123, text=str.tostring(math.round_to_mintick(sar123)), color=colup123, style=label.style_label_up, size=size.small,textcolor = color.lime)
if ta.change(trend123) < 0 and putlabel123
label.new(bar_index, sar123, text=str.tostring(math.round_to_mintick(sar123)), color=coldn123, style=label.style_label_down, size=size.small, textcolor = color.red)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
start1234 = input.float(title='Start', defval=0, step=0.1)
increment1234 = input.float(title='Increment', defval=0.01, step=0.1)
maximum1234 = input.float(title='Max Value', defval=0.1, step=0.1)
putlabel1234 = input(title='Put Labels', defval=true)
colup1234 = input.color(title='Colors', defval=color.rgb(0, 230, 119, 100), inline='col')
coldn1234 = input.color(title='', defval=color.rgb(255, 82, 82, 100), inline='col')
int trend1234 = 0
float sar1234 = 0.0
float ep1234 = 0.0
float af1234 = 0.0
trend1234 := nz(trend1234[1])
ep1234 := nz(ep1234[1])
af1234 := nz(af1234[1])
sar1234 := sar1234[1]
if trend1234 == 0 and not na(high[1])
trend1234 := high >= high[1] or low >= low[1] ? 1 : -1
sar1234 := trend1234 > 0 ? low[1] : high[1]
ep1234 := trend1234 > 0 ? high[1] : low[1]
af1234 := start1234
af1234
else
nextsar1234 = sar1234
if trend1234 > 0
if high[1] > ep1234
ep1234 := high[1]
af1234 := math.min(maximum1234, af1234 + increment1234)
af1234
nextsar1234 := sar1234 + af1234 * (ep1234 - sar1234)
nextsar1234 := math.min(math.min(low[1], low[2]), nextsar1234)
//Reversal
if nextsar1234 > low
trend1234 := -1
nextsar1234 := ep1234
ep1234 := low
af1234 := start1234
af1234
else
if low[1] < ep1234
ep1234 := low[1]
af1234 := math.min(maximum1234, af1234 + increment1234)
af1234
nextsar1234 := sar1234 + af1234 * (ep1234 - sar1234)
nextsar1234 := math.max(math.max(high[1], high[2]), nextsar1234)
//Reversal
if nextsar1234 < high
trend1234 := 1
nextsar1234 := ep1234
ep1234 := high
af1234 := start1234
af1234
sar1234 := nextsar1234
sar1234
plot(sar1234, title='5.Döngü', color=trend1234 > 0 ? colup1234 : coldn1234, linewidth=1, style=plot.style_line)
if ta.change(trend1234) > 0 and putlabel1234
label.new(bar_index, sar1234, text=str.tostring(math.round_to_mintick(sar1234)), color=colup1234, style=label.style_label_up, size=size.small, textcolor = color.lime)
if ta.change(trend1234) < 0 and putlabel1234
label.new(bar_index, sar1234, text=str.tostring(math.round_to_mintick(sar1234)), color=coldn1234, style=label.style_label_down, size=size.small, textcolor = color.red)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
start12345 = input.float(title='Start', defval=0.05, step=0.1)
increment12345 = input.float(title='Increment', defval=0.075, step=0.1)
maximum12345 = input.float(title='Max Value', defval=0.35, step=0.1)
putlabel12345 = input(title='Put Labels', defval=true)
colup12345 = input.color(title='Colors', defval=color.rgb(0, 230, 119, 100), inline='col')
coldn12345 = input.color(title='', defval=color.rgb(255, 82, 82, 100), inline='col')
int trend12345 = 0
float sar12345 = 0.0
float ep12345 = 0.0
float af12345 = 0.0
trend12345 := nz(trend12345[1])
ep12345 := nz(ep12345[1])
af12345 := nz(af12345[1])
sar12345 := sar12345[1]
if trend12345 == 0 and not na(high[1])
trend12345 := high >= high[1] or low >= low[1] ? 1 : -1
sar12345 := trend12345 > 0 ? low[1] : high[1]
ep12345 := trend12345 > 0 ? high[1] : low[1]
af12345 := start12345
af12345
else
nextsar12345 = sar12345
if trend12345 > 0
if high[1] > ep12345
ep12345 := high[1]
af12345 := math.min(maximum12345, af12345 + increment12345)
af12345
nextsar12345 := sar12345 + af12345 * (ep12345 - sar12345)
nextsar12345 := math.min(math.min(low[1], low[2]), nextsar12345)
//Reversal
if nextsar12345 > low
trend12345 := -1
nextsar12345 := ep12345
ep12345 := low
af12345 := start12345
af12345
else
if low[1] < ep12345
ep12345 := low[1]
af12345 := math.min(maximum12345, af12345 + increment12345)
af12345
nextsar12345 := sar12345 + af12345 * (ep12345 - sar12345)
nextsar12345 := math.max(math.max(high[1], high[2]), nextsar12345)
//Reversal
if nextsar12345 < high
trend12345 := 1
nextsar12345 := ep12345
ep12345 := high
af12345 := start12345
af12345
sar12345 := nextsar12345
sar12345
plot(sar12345, title='1.Döngü', color=trend12345 > 0 ? colup12345 : coldn12345, linewidth=1, style=plot.style_line)
if ta.change(trend12345) > 0 and putlabel12345
label.new(bar_index, sar12345, text=str.tostring(math.round_to_mintick(sar12345)), color=colup12345, style=label.style_label_up, size=size.small, textcolor = color.lime)
if ta.change(trend12345) < 0 and putlabel1234
label.new(bar_index, sar12345, text=str.tostring(math.round_to_mintick(sar12345)), color=coldn12345, style=label.style_label_down, size=size.small, textcolor = color.red)
////////////////////////////////////////////////////////
-