https://tr.tradingview.com/v/xQSGzY4E/ 50-200 yerine 5-20 kullanlm hali....
https://www.tradingview.com/x/voJvSbOn/
https://tr.tradingview.com/v/xQSGzY4E/ 50-200 yerine 5-20 kullanlm hali....
https://www.tradingview.com/x/voJvSbOn/
16.07.2024 - 10.12.2024
https://tr.tradingview.com/v/T2juFbHt/
2 farkl zaman dilimi kullanarak...spertrend yntemiyle....trend hesaplama....
https://www.tradingview.com/x/wsILPfOu/
bu da saatlik ve seanaslk kodun birlemi hali......
https://www.tradingview.com/x/I4Ab0Ggb/
denenip...testleri yaplabilir......PHP Code://@version=5
strategy('deneme', overlay=true, format=format.price)
////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// peacefulLizard50262
//@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, float 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
// Chebyshev Type II Moving Average
chebyshevII(float src, float len, float ripple) =>
a = 0.
b = 0.
g = 0.
chebyshev = 0.
a := cosh(1 / len * acosh(1 / ripple))
b := sinh(1 / len * asinh(ripple))
g := (a - b) / (a + b)
chebyshev := (1 - g) * src + g * nz(chebyshev[1], src)
chebyshev
chebyshev(float src, float length, float ripple, bool style) =>
style ?
chebyshevI(src, length, ripple) :
chebyshevII(src, length, ripple)
source44 = input.source(hl2, "Source")
up_color = input.color(color.new(color.green, 20), "Up Color")
down_color = input.color(color.new(color.red, 20), "Down Color")
text_color = input.color(color.black, "Text Color")
mean_length = input.float(24, "Mean Length", 5, 1000, 0.5)
mean_ripple = input.float(0.5, "Mean Ripple", 0.01, 0.99, 0.01)
style44 = input.bool(false, "True Chebyshev I | False : Chebyshev II")
atr_style = input.bool(true, "True: |Open-Close| False: High-Low")
atr_length = input.float(64, "ATR Length", 6, 1000, 0.5)
atr_ripple = input.float(0.05, "Mean Ripple", 0.01, 0.99, 0.01)
multiplier = input.float(1.5, "Multiplier", 0.125, 10, 0.125)
alerts = input.bool(false, "Alerts")
labels = input.bool(true, "Labels")
atr = chebyshev(atr_style ? high - low : math.abs(open - close), atr_length, atr_ripple, style44)
mean = chebyshevI(source44, mean_length, mean_ripple)
var float offset = 0.0
var bool state = na
var float newOffset = 0.0
crossover = ta.crossover(source44, offset)
position = source44 > offset
crossunder = ta.crossunder(source44, offset)
prevOffset = nz(offset[1])
if crossover[2] and position[1] and position or (position and position[1] and position[2])
newOffset := mean - atr * multiplier
offset := newOffset < nz(prevOffset) or close[1] > nz(prevOffset) ? newOffset : nz(prevOffset)
state := true
if crossunder[2] and not position[1] and not position or (not position and not position[1] and not position[2])
newOffset := mean + atr * multiplier
offset := newOffset > nz(prevOffset) or close[1] < nz(prevOffset) ? newOffset : nz(prevOffset)
state := false
cross = ta.cross(close, offset)
down_trend = not state and not state[1]
up_trend = state and state[1]
colour = up_trend ? up_color : down_trend ? down_color : color.new(color.white, 100)
if up_trend and not up_trend[1] and labels
label.new(bar_index, offset, "Up Trend \n" + str.tostring(close), color = up_color, style = label.style_label_up, textcolor = text_color)
alert("Up Trend at " + str.tostring(close))
else
alert("Up Trend at " + str.tostring(close))
if down_trend and not down_trend[1] and labels
label.new(bar_index, offset, "Down Trend \n" + str.tostring(close), color = down_color, style = label.style_label_down, textcolor = text_color)
alert("Down Trend at " + str.tostring(close))
else
alert("Down Trend at " + str.tostring(close))
plot(offset, "Trend", colour, style = plot.style_stepline_diamond)
plotshape(cross, "Trend Is Getting Ready To Change", shape.xcross, location.belowbar, color = close > offset ? up_color : down_color)
////////////////////////////////////////////
/// Creator: Tim Tillson (T3 Moving Average)
// Author: @dg_factor [09.12.2021]
// UYARI :
// Gelitirme amaldr. Risk ynetimi olmakszn alm-satm stratejisi yerine ikame edilemez.
// AIKLAMALAR
// Orijinal hasaplamalara sadk kalnarak farkl derecelerde (1-5) binom almlar uyguland.
// EMA dahil, toplamda yedi farkl hareketli ortalama tr zerinde alabilen dinamik bir yap ina edildi.
// Derece ve ortalama tr, opsiyonel birer parametre olarak kullanc tercihine sunuldu.
// Dier detaylar en aada.
//@version=5
// Inputs
src = close
length = input(title='Length', defval=20)
factor = input.float(title='Factor', defval=0.7, step=0.1)
degree = input.int(title='Degree', minval=1, maxval=5, defval=3, tooltip='1-5', group="DEGREE & TYPE")
ma_type = input.string(title="Type", defval="EMA", options=["EMA", "RMA", "EVMA", "GAUS", "HULLT", "MCGD", "TSF"], group="DEGREE & TYPE")
// MA Functions
// EVMA [Elastic Volume Weighted Moving Average]
f_evma(data, u1) =>
x = ta.sma(data, u1)
a = math.sum(volume, u1)
r = 0.0
r := na(r[1]) ? x : nz(r[1]) * (a - volume) / a + volume * data / a
//
// GAUS [Ehlers - Gaussian Filter]
f_gaus(data, u1) =>
a = (1 - math.cos(2 * math.pi / u1)) / (math.sqrt(2) - 1)
b = -a + math.sqrt(math.pow(a, 2) + 2 * a)
r = 0.0
r := na(r[1]) ? data : math.pow(b, 2) * data + 2 * (1 - b) * nz(r[1]) - math.pow(1 - b, 2) * nz(r[2])
//
// HULLT [Triple Hull Moving Average]
f_hullt(data, u1) =>
a = u1 < 3 ? 1 : u1 / 2
b = u1 < 3 ? 1 : u1 / 3
r = ta.wma(ta.wma(data, b) * 3 - ta.wma(data, a) - ta.wma(data, u1), u1)
//
// MCGD [McGinley Dynamic Moving Average]
f_mcgd(data, u1) =>
a = ta.ema(data, u1)
r = 0.0
r := na(r[1]) ? a : r[1] + (data - r[1]) / (u1 * math.pow(data / r[1], 4))
//
// TSF [Time Series Function]
f_tsf(data, u1) =>
2 * ta.linreg(data, u1, 0) - ta.linreg(data, u1, 1)
// MA Return
f_ma(data, u1) =>
ma_type == "EMA" ? ta.ema(data, u1) :
ma_type == "EVMA" ? f_evma(data, u1) :
ma_type == "GAUS" ? f_gaus(data, u1) :
ma_type == "HULLT" ? f_hullt(data, u1) :
ma_type == "MCGD" ? f_mcgd(data, u1) :
ma_type == "RMA" ? ta.rma(data, u1) :
ma_type == "TSF" ? f_tsf(data, u1) :
na
//
// Variables
x = factor
y = factor + 1
z = f_ma(src, length)
n = f_ma(z, length)
// Degreed Tillson MA Functions
d1(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
b0 = -1 * 1 * math.pow(x, 1) * math.pow(y, 0)
b1 = +1 * 1 * math.pow(x, 0) * math.pow(y, 1)
r = b0 * a1 + b1 * a0
//
d2(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
b0 = +1 * 1 * math.pow(x, 2) * math.pow(y, 0)
b1 = -1 * 2 * math.pow(x, 1) * math.pow(y, 1)
b2 = +1 * 1 * math.pow(x, 0) * math.pow(y, 2)
r = b0 * a2 + b1 * a1 + b2 * a0
//
d3(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
b0 = -1 * 1 * math.pow(x, 3) * math.pow(y, 0)
b1 = +1 * 3 * math.pow(x, 2) * math.pow(y, 1)
b2 = -1 * 3 * math.pow(x, 1) * math.pow(y, 2)
b3 = +1 * 1 * math.pow(x, 0) * math.pow(y, 3)
r = b0 * a3 + b1 * a2 + b2 * a1 + b3 * a0
//
d4(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
a4 = f_ma(a3, length)
b0 = +1 * 1 * math.pow(x, 4) * math.pow(y, 0)
b1 = -1 * 4 * math.pow(x, 3) * math.pow(y, 1)
b2 = +1 * 6 * math.pow(x, 2) * math.pow(y, 2)
b3 = -1 * 4 * math.pow(x, 1) * math.pow(y, 3)
b4 = +1 * 1 * math.pow(x, 0) * math.pow(y, 4)
r = b0 * a4 + b1 * a3 + b2 * a2 + b3 * a1 + b4 * a0
//
d5(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
a4 = f_ma(a3, length)
a5 = f_ma(a4, length)
b0 = -1 * 1 * math.pow(x, 5) * math.pow(y, 0)
b1 = +1 * 5 * math.pow(x, 4) * math.pow(y, 1)
b2 = -1 * 10 * math.pow(x, 3) * math.pow(y, 2)
b3 = +1 * 10 * math.pow(x, 2) * math.pow(y, 3)
b4 = -1 * 5 * math.pow(x, 1) * math.pow(y, 4)
b5 = +1 * 1 * math.pow(x, 0) * math.pow(y, 5)
r = b0 * a5 + b1 * a4 + b2 * a3 + b3 * a2 + b4 * a1 + b5 * a0
//
// Out
out =
degree == 1 ? d1(src, length) :
degree == 2 ? d2(src, length) :
degree == 3 ? d3(src, length) :
degree == 4 ? d4(src, length) :
degree == 5 ? d5(src, length) :
na
//
plot(out, color=#3082a500, title='Tillson MA')
barcolor(out > out[1] ? #00bb00 : out < out[1] ? #bb0000 : #333333)
// Bitti
//plotshape(barstate.isfirst, title="@ dg_factor", color=#13172200, editable=false)
// DETAYLAR
// T3'teki "3" nedir?
// T3 Moving Average, i ie kurgulanm ssel hareketli ortalamalarn nc dereceden binom alm alnarak hesaplanr.
// T3 eklinde adlandrlmasnn nedeni budur.
// Ufak bir matematiksel mdahale ile farkl dereceler kodlanabilir, netekim bu indikatr yntem olarak arpanlara ayrma nermektedir.
// mer Hayyam'n mevzuyla ne ilgisi var?
// Binom alm, Pascal geni olarak bilinen bir tamsay dizisine dayanr.
// smi Pascal'la anlsa da, bu gensel say dizisinin ilk olarak mer Hayyam'n hesaplamalarnda tanmland kabul edilir.
// Pascal geninin kartezyen toplamlar kullanlarak Fibonacci dizisini elde etmek de mmkndr.
// Yaylm rntlerini aklamadaki gc bakmndan Pascal geni ska kullanlan bir argmandr.
// zetle finansal algoritmalar Hayyam'a ok ey borludur.
// Ne ie yarayacak?
// Bama bir i gelmeyecekse;
// Trendi genellikle yakalar, ama terste brakma ihtimali de yksektir. Risk ynetimi bu yzden gerekli.
// Farkl dereceler fiyat frekansn retebilecek yntemlere katk sunabilir.
// Hatta ortalamaya ait nceki tepe ve diplerin yeni sinyal yn iin geerli destek/diren seviyeleri olarak alt da oluyor.
// Tabi herhangi bir ie yaramayabilir de :).
////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Baby_whale_to_moon
//@version=5
// BACKTEST DATE
Start_Time = input.time(defval=timestamp('01 January 2017 13:30 +0000'), title='Start_Time', group = " ################# BACKTEST DATE ################ " )
End_Time = input.time(defval=timestamp('30 April 2024 19:30 +0000'), title='End_Time', group = " ################# BACKTEST DATE ################ " )
// supertrend
atrPeriod = input(10, 'ATR Length', group = " ################# Supertrend ################ ")
factor77 = input(3, 'Factor', group = " ################# Supertrend ################ ")
time1 = input.string(title='Short Time Period', defval='07 1h', options=['01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our short-time supertrend indicator")
time2 = input.string(title='Long Time Period', defval='10 4h', options=[ '01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our long-time supertrend indicator")
res(Resolution) =>
if Resolution == '00 Current'
timeframe.period
else
if Resolution == '01 1m'
'1'
else
if Resolution == '02 3m'
'3'
else
if Resolution == '03 5m'
'5'
else
if Resolution == '04 15m'
'15'
else
if Resolution == '05 30m'
'30'
else
if Resolution == '06 45m'
'45'
else
if Resolution == '07 1h'
'60'
else
if Resolution == '08 2h'
'120'
else
if Resolution == '09 3h'
'180'
else
if Resolution == '10 4h'
'240'
else
if Resolution == '11 1D'
'1D'
else
if Resolution == '12 1W'
'1W'
else
if Resolution == '13 1M'
'1M'
// supertrend Long time period
[supertrend2, direction2] = request.security(syminfo.tickerid, res(time2), ta.supertrend(factor77, atrPeriod))
bodyMiddle4 = plot((open + close) / 2, display=display.none)
upTrend2 = plot(direction2 < 0 ? supertrend2 : na, 'seans up', color=color.new(#4caf4f, 100), style=plot.style_linebr, linewidth=2)
downTrend2 = plot(direction2 < 0 ? na : supertrend2, 'seans Down', color=color.new(#ff5252, 100), style=plot.style_linebr, linewidth=2)
// supertrend short time period
[supertrend1, direction1] = request.security(syminfo.tickerid, res(time1), ta.supertrend(factor77, atrPeriod))
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction1 < 0 ? supertrend1 : na, 'saat Up ', color=color.new(#ffeb3b, 100), style=plot.style_linebr)
downTrend = plot(direction1 < 0 ? na : supertrend1, 'saat Down ', color=color.new(#ff9900, 100), style=plot.style_linebr)
// Stochastic RSI
low_limit_stoch_rsi = input.float(title = 'Stoch Rsi Low Limit', step=0.5, defval=15, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossover Low Limit value we get Long")
up_limit_stoch_rsi = input.float(title = 'Stoch Rsi Up Limit', step=0.5, defval=85, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossunder Up Limit value we get Short")
stocrsi_back_length = input.int(20, 'Stoch Rsi retroactive length', minval=1, group = " ################# Stoch RSI ################ ", tooltip = "How many candles are left behind, even if there is a buy or sell signal, it will be valid now")
smoothK = input.int(3, 'Stochastic RSI K', minval=1, group = " ################# Stoch RSI ################ ")
lengthRSI = input.int(14, 'RSI Length', minval=1, group = " ################# Stoch RSI ################ ")
lengthStoch = input.int(14, 'Stochastic Length', minval=1, group = " ################# Stoch RSI ################ ")
src_rsi = input(close, title='RSI Source', group = " ################# Stoch RSI ################ ")
rsi1 = request.security(syminfo.tickerid, '240', ta.rsi(src_rsi, lengthRSI))
k = request.security(syminfo.tickerid, '240', ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK))
////////////////////////////////////////
1 dakkalkta grafii bozmad en azndan.....
16.07.2024 - 10.12.2024
https://tr.tradingview.com/v/ziw9l3lF/
supertrend fiboya gre long short ayo....
https://www.tradingview.com/x/17ua8ktC/
PHP Code://@version=5
indicator("deneme", overlay = true, max_lines_count = 500, max_labels_count = 500, format=format.price)
////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// peacefulLizard50262
//@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, float 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
// Chebyshev Type II Moving Average
chebyshevII(float src, float len, float ripple) =>
a = 0.
b = 0.
g = 0.
chebyshev = 0.
a := cosh(1 / len * acosh(1 / ripple))
b := sinh(1 / len * asinh(ripple))
g := (a - b) / (a + b)
chebyshev := (1 - g) * src + g * nz(chebyshev[1], src)
chebyshev
chebyshev(float src, float length, float ripple, bool style) =>
style ?
chebyshevI(src, length, ripple) :
chebyshevII(src, length, ripple)
source44 = input.source(hl2, "Source")
up_color = input.color(color.new(color.green, 20), "Up Color")
down_color = input.color(color.new(color.red, 20), "Down Color")
text_color = input.color(color.black, "Text Color")
mean_length = input.float(24, "Mean Length", 5, 1000, 0.5)
mean_ripple = input.float(0.5, "Mean Ripple", 0.01, 0.99, 0.01)
style44 = input.bool(false, "True Chebyshev I | False : Chebyshev II")
atr_style = input.bool(true, "True: |Open-Close| False: High-Low")
atr_length = input.float(64, "ATR Length", 6, 1000, 0.5)
atr_ripple = input.float(0.05, "Mean Ripple", 0.01, 0.99, 0.01)
multiplier = input.float(1.5, "Multiplier", 0.125, 10, 0.125)
alerts = input.bool(false, "Alerts")
labels = input.bool(true, "Labels")
atr = chebyshev(atr_style ? high - low : math.abs(open - close), atr_length, atr_ripple, style44)
mean = chebyshevI(source44, mean_length, mean_ripple)
var float offset = 0.0
var bool state = na
var float newOffset = 0.0
crossover = ta.crossover(source44, offset)
position = source44 > offset
crossunder = ta.crossunder(source44, offset)
prevOffset = nz(offset[1])
if crossover[2] and position[1] and position or (position and position[1] and position[2])
newOffset := mean - atr * multiplier
offset := newOffset < nz(prevOffset) or close[1] > nz(prevOffset) ? newOffset : nz(prevOffset)
state := true
if crossunder[2] and not position[1] and not position or (not position and not position[1] and not position[2])
newOffset := mean + atr * multiplier
offset := newOffset > nz(prevOffset) or close[1] < nz(prevOffset) ? newOffset : nz(prevOffset)
state := false
cross = ta.cross(close, offset)
down_trend = not state and not state[1]
up_trend = state and state[1]
colour = up_trend ? up_color : down_trend ? down_color : color.new(color.white, 100)
if up_trend and not up_trend[1] and labels
label.new(bar_index, offset, "Up Trend \n" + str.tostring(close), color = up_color, style = label.style_label_up, textcolor = text_color)
alert("Up Trend at " + str.tostring(close))
else
alert("Up Trend at " + str.tostring(close))
if down_trend and not down_trend[1] and labels
label.new(bar_index, offset, "Down Trend \n" + str.tostring(close), color = down_color, style = label.style_label_down, textcolor = text_color)
alert("Down Trend at " + str.tostring(close))
else
alert("Down Trend at " + str.tostring(close))
plot(offset, "Trend", colour, style = plot.style_stepline_diamond)
plotshape(cross, "Trend Is Getting Ready To Change", shape.xcross, location.belowbar, color = close > offset ? up_color : down_color)
////////////////////////////////////////////
/// Creator: Tim Tillson (T3 Moving Average)
// Author: @dg_factor [09.12.2021]
// UYARI :
// Gelitirme amaldr. Risk ynetimi olmakszn alm-satm stratejisi yerine ikame edilemez.
// AIKLAMALAR
// Orijinal hasaplamalara sadk kalnarak farkl derecelerde (1-5) binom almlar uyguland.
// EMA dahil, toplamda yedi farkl hareketli ortalama tr zerinde alabilen dinamik bir yap ina edildi.
// Derece ve ortalama tr, opsiyonel birer parametre olarak kullanc tercihine sunuldu.
// Dier detaylar en aada.
//@version=5
// Inputs
src = close
length = input(title='Length', defval=20)
factor = input.float(title='Factor', defval=0.7, step=0.1)
degree = input.int(title='Degree', minval=1, maxval=5, defval=3, tooltip='1-5', group="DEGREE & TYPE")
ma_type = input.string(title="Type", defval="EMA", options=["EMA", "RMA", "EVMA", "GAUS", "HULLT", "MCGD", "TSF"], group="DEGREE & TYPE")
// MA Functions
// EVMA [Elastic Volume Weighted Moving Average]
f_evma(data, u1) =>
x = ta.sma(data, u1)
a = math.sum(volume, u1)
r = 0.0
r := na(r[1]) ? x : nz(r[1]) * (a - volume) / a + volume * data / a
//
// GAUS [Ehlers - Gaussian Filter]
f_gaus(data, u1) =>
a = (1 - math.cos(2 * math.pi / u1)) / (math.sqrt(2) - 1)
b = -a + math.sqrt(math.pow(a, 2) + 2 * a)
r = 0.0
r := na(r[1]) ? data : math.pow(b, 2) * data + 2 * (1 - b) * nz(r[1]) - math.pow(1 - b, 2) * nz(r[2])
//
// HULLT [Triple Hull Moving Average]
f_hullt(data, u1) =>
a = u1 < 3 ? 1 : u1 / 2
b = u1 < 3 ? 1 : u1 / 3
r = ta.wma(ta.wma(data, b) * 3 - ta.wma(data, a) - ta.wma(data, u1), u1)
//
// MCGD [McGinley Dynamic Moving Average]
f_mcgd(data, u1) =>
a = ta.ema(data, u1)
r = 0.0
r := na(r[1]) ? a : r[1] + (data - r[1]) / (u1 * math.pow(data / r[1], 4))
//
// TSF [Time Series Function]
f_tsf(data, u1) =>
2 * ta.linreg(data, u1, 0) - ta.linreg(data, u1, 1)
// MA Return
f_ma(data, u1) =>
ma_type == "EMA" ? ta.ema(data, u1) :
ma_type == "EVMA" ? f_evma(data, u1) :
ma_type == "GAUS" ? f_gaus(data, u1) :
ma_type == "HULLT" ? f_hullt(data, u1) :
ma_type == "MCGD" ? f_mcgd(data, u1) :
ma_type == "RMA" ? ta.rma(data, u1) :
ma_type == "TSF" ? f_tsf(data, u1) :
na
//
// Variables
x = factor
y = factor + 1
z = f_ma(src, length)
n = f_ma(z, length)
// Degreed Tillson MA Functions
d1(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
b0 = -1 * 1 * math.pow(x, 1) * math.pow(y, 0)
b1 = +1 * 1 * math.pow(x, 0) * math.pow(y, 1)
r = b0 * a1 + b1 * a0
//
d2(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
b0 = +1 * 1 * math.pow(x, 2) * math.pow(y, 0)
b1 = -1 * 2 * math.pow(x, 1) * math.pow(y, 1)
b2 = +1 * 1 * math.pow(x, 0) * math.pow(y, 2)
r = b0 * a2 + b1 * a1 + b2 * a0
//
d3(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
b0 = -1 * 1 * math.pow(x, 3) * math.pow(y, 0)
b1 = +1 * 3 * math.pow(x, 2) * math.pow(y, 1)
b2 = -1 * 3 * math.pow(x, 1) * math.pow(y, 2)
b3 = +1 * 1 * math.pow(x, 0) * math.pow(y, 3)
r = b0 * a3 + b1 * a2 + b2 * a1 + b3 * a0
//
d4(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
a4 = f_ma(a3, length)
b0 = +1 * 1 * math.pow(x, 4) * math.pow(y, 0)
b1 = -1 * 4 * math.pow(x, 3) * math.pow(y, 1)
b2 = +1 * 6 * math.pow(x, 2) * math.pow(y, 2)
b3 = -1 * 4 * math.pow(x, 1) * math.pow(y, 3)
b4 = +1 * 1 * math.pow(x, 0) * math.pow(y, 4)
r = b0 * a4 + b1 * a3 + b2 * a2 + b3 * a1 + b4 * a0
//
d5(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
a4 = f_ma(a3, length)
a5 = f_ma(a4, length)
b0 = -1 * 1 * math.pow(x, 5) * math.pow(y, 0)
b1 = +1 * 5 * math.pow(x, 4) * math.pow(y, 1)
b2 = -1 * 10 * math.pow(x, 3) * math.pow(y, 2)
b3 = +1 * 10 * math.pow(x, 2) * math.pow(y, 3)
b4 = -1 * 5 * math.pow(x, 1) * math.pow(y, 4)
b5 = +1 * 1 * math.pow(x, 0) * math.pow(y, 5)
r = b0 * a5 + b1 * a4 + b2 * a3 + b3 * a2 + b4 * a1 + b5 * a0
//
// Out
out =
degree == 1 ? d1(src, length) :
degree == 2 ? d2(src, length) :
degree == 3 ? d3(src, length) :
degree == 4 ? d4(src, length) :
degree == 5 ? d5(src, length) :
na
//
plot(out, color=#3082a500, title='Tillson MA')
barcolor(out > out[1] ? #00bb00 : out < out[1] ? #bb0000 : #333333)
// Bitti
//plotshape(barstate.isfirst, title="@ dg_factor", color=#13172200, editable=false)
// DETAYLAR
// T3'teki "3" nedir?
// T3 Moving Average, i ie kurgulanm ssel hareketli ortalamalarn nc dereceden binom alm alnarak hesaplanr.
// T3 eklinde adlandrlmasnn nedeni budur.
// Ufak bir matematiksel mdahale ile farkl dereceler kodlanabilir, netekim bu indikatr yntem olarak arpanlara ayrma nermektedir.
// mer Hayyam'n mevzuyla ne ilgisi var?
// Binom alm, Pascal geni olarak bilinen bir tamsay dizisine dayanr.
// smi Pascal'la anlsa da, bu gensel say dizisinin ilk olarak mer Hayyam'n hesaplamalarnda tanmland kabul edilir.
// Pascal geninin kartezyen toplamlar kullanlarak Fibonacci dizisini elde etmek de mmkndr.
// Yaylm rntlerini aklamadaki gc bakmndan Pascal geni ska kullanlan bir argmandr.
// zetle finansal algoritmalar Hayyam'a ok ey borludur.
// Ne ie yarayacak?
// Bama bir i gelmeyecekse;
// Trendi genellikle yakalar, ama terste brakma ihtimali de yksektir. Risk ynetimi bu yzden gerekli.
// Farkl dereceler fiyat frekansn retebilecek yntemlere katk sunabilir.
// Hatta ortalamaya ait nceki tepe ve diplerin yeni sinyal yn iin geerli destek/diren seviyeleri olarak alt da oluyor.
// Tabi herhangi bir ie yaramayabilir de :).
////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Baby_whale_to_moon
//@version=5
// BACKTEST DATE
Start_Time = input.time(defval=timestamp('01 January 2017 13:30 +0000'), title='Start_Time', group = " ################# BACKTEST DATE ################ " )
End_Time = input.time(defval=timestamp('30 April 2024 19:30 +0000'), title='End_Time', group = " ################# BACKTEST DATE ################ " )
// supertrend
atrPeriod = input(10, 'ATR Length', group = " ################# Supertrend ################ ")
factor77 = input(3, 'Factor', group = " ################# Supertrend ################ ")
time1 = input.string(title='Short Time Period', defval='07 1h', options=['01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our short-time supertrend indicator")
time2 = input.string(title='Long Time Period', defval='10 4h', options=[ '01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our long-time supertrend indicator")
res(Resolution) =>
if Resolution == '00 Current'
timeframe.period
else
if Resolution == '01 1m'
'1'
else
if Resolution == '02 3m'
'3'
else
if Resolution == '03 5m'
'5'
else
if Resolution == '04 15m'
'15'
else
if Resolution == '05 30m'
'30'
else
if Resolution == '06 45m'
'45'
else
if Resolution == '07 1h'
'60'
else
if Resolution == '08 2h'
'120'
else
if Resolution == '09 3h'
'180'
else
if Resolution == '10 4h'
'240'
else
if Resolution == '11 1D'
'1D'
else
if Resolution == '12 1W'
'1W'
else
if Resolution == '13 1M'
'1M'
// supertrend Long time period
[supertrend2, direction2] = request.security(syminfo.tickerid, res(time2), ta.supertrend(factor77, atrPeriod))
bodyMiddle4 = plot((open + close) / 2, display=display.none)
upTrend2 = plot(direction2 < 0 ? supertrend2 : na, 'seans up', color=color.new(#4caf4f, 100), style=plot.style_linebr, linewidth=2)
downTrend2 = plot(direction2 < 0 ? na : supertrend2, 'seans Down', color=color.new(#ff5252, 100), style=plot.style_linebr, linewidth=2)
// supertrend short time period
[supertrend1, direction1] = request.security(syminfo.tickerid, res(time1), ta.supertrend(factor77, atrPeriod))
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction1 < 0 ? supertrend1 : na, 'saat Up ', color=color.new(#ffeb3b, 100), style=plot.style_linebr)
downTrend = plot(direction1 < 0 ? na : supertrend1, 'saat Down ', color=color.new(#ff9900, 100), style=plot.style_linebr)
// Stochastic RSI
low_limit_stoch_rsi = input.float(title = 'Stoch Rsi Low Limit', step=0.5, defval=15, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossover Low Limit value we get Long")
up_limit_stoch_rsi = input.float(title = 'Stoch Rsi Up Limit', step=0.5, defval=85, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossunder Up Limit value we get Short")
stocrsi_back_length = input.int(20, 'Stoch Rsi retroactive length', minval=1, group = " ################# Stoch RSI ################ ", tooltip = "How many candles are left behind, even if there is a buy or sell signal, it will be valid now")
smoothK = input.int(3, 'Stochastic RSI K', minval=1, group = " ################# Stoch RSI ################ ")
lengthRSI = input.int(14, 'RSI Length', minval=1, group = " ################# Stoch RSI ################ ")
lengthStoch = input.int(14, 'Stochastic Length', minval=1, group = " ################# Stoch RSI ################ ")
src_rsi = input(close, title='RSI Source', group = " ################# Stoch RSI ################ ")
rsi1 = request.security(syminfo.tickerid, '240', ta.rsi(src_rsi, lengthRSI))
k = request.security(syminfo.tickerid, '240', ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK))
////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// MUQWISHI
//@version=5
// |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
// | INPUT |
// |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
// SuperTrend
supAtr = input.int(10, "ATR Length", 1, group = "Supertrend", inline = "1")
factor88 = input.float(3.0, " Factor", group = "Supertrend", inline = "1")
pltChk = input.bool(true, "Show Supertrend Line?", group = "Supertrend", inline = "2")
upCol = input.color(color.green, " ", group = "Supertrend", inline = "2")
dnCol = input.color(color.red, "", group = "Supertrend", inline = "2")
// Table Style
tablePos = input.string("Top Right", "RunUp Statistics Table Location ",
["Hide", "Top Right" , "Middle Right" , "Bottom Right" ,
"Top Center", "Middle Center" , "Bottom Center",
"Top Left" , "Middle Left" , "Bottom Left" ], inline = "1", group = "Fibonacci Run-Up Historical Statistics Table")
tBgCol = input.color(#696969, "Title", inline = "2", group = "Fibonacci Run-Up Historical Statistics Table")
cBgCol = input.color(#A9A9A9, " Cell", inline = "2", group = "Fibonacci Run-Up Historical Statistics Table")
txtCol = input.color(#ffffff, " Text", inline = "2", group = "Fibonacci Run-Up Historical Statistics Table")
// Line Style
linExt = input.string("None Extend", "Lines ",
["Hide", "Right Extend", "Left Extend", "Both Extend", "None Extend"], group = "Line & Label Style", inline = "line")
linSty = input.string("________", "",
["________", "-----------", "..........."], group = "Line & Label Style", inline = "line")
linSiz = input.int(2, "", 1, tooltip = "Line Extend | Line Style | Line Size", group = "Line & Label Style", inline = "line")
// Label Style
lblPos = input.string("Right", "Labels", ["Hide", "Right"], group = "Line & Label Style", inline = "label")
lblSty = input.string("Percent", "",
["Percent", "Value", "Price", "Percent & Price", "Value & Price"], group = "Line & Label Style", inline = "label")
lblSiz = input.string("Small", "",
["Auto", "Huge", "Large", "Normal", "Small", "Tiny"], group = "Line & Label Style", inline = "label",
tooltip = "Label Position | Label Style | Label Size")
// Fibonacci
lastSet = input.bool(true, "Apply Fibonacci Levels to ONLY Last Supertrend Direction", group = "Fibonacci Levels")
confrim = input.bool(true, "Apply Fibonacci Levels After Confirmed Signal", group = "Fibonacci Levels")
bgTrans = input.int(85, "Background Transparency", 0, 100, group = "Fibonacci Levels")
lnTrans = input.int(50, "Line Transparency ", 0, 100, group = "Fibonacci Levels")
trndChk = input.bool(true, "Show Trend Line", group = "Fibonacci Levels", inline = "0")
trndCol = input.color(color.new(#64b5f6, 50), " ", group = "Fibonacci Levels", inline = "0")
shw01 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level00")
val01 = input.float(0.0, "", group = "Fibonacci Levels", inline = "Level00")
col01 = input.color(#787b86, "", group = "Fibonacci Levels", inline = "Level00")
shw02 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level00")
val02 = input.float(0.236, "", group = "Fibonacci Levels", inline = "Level00")
col02 = input.color(#f44336,"", group = "Fibonacci Levels", inline = "Level00")
shw03 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level01")
val03 = input.float(0.382, "", group = "Fibonacci Levels", inline = "Level01")
col03 = input.color(#81c784, "", group = "Fibonacci Levels", inline = "Level01")
shw04 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level01")
val04 = input.float(0.5, "", group = "Fibonacci Levels", inline = "Level01")
col04 = input.color(#4caf50, "", group = "Fibonacci Levels", inline = "Level01")
shw05 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level02")
val05 = input.float(0.618, "", group = "Fibonacci Levels", inline = "Level02")
col05 = input.color(#009688, "", group = "Fibonacci Levels", inline = "Level02")
shw06 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level02")
val06 = input.float(0.786, "", group = "Fibonacci Levels", inline = "Level02")
col06 = input.color(#009688, "", group = "Fibonacci Levels", inline = "Level02")
shw07 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level03")
val07 = input.float(1.0, "", group = "Fibonacci Levels", inline = "Level03")
col07 = input.color(#64b5f6, "", group = "Fibonacci Levels", inline = "Level03")
shw08 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level03")
val08 = input.float(1.618, "", group = "Fibonacci Levels", inline = "Level03")
col08 = input.color(#da7d31, "", group = "Fibonacci Levels", inline = "Level03")
shw09 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level04")
val09 = input.float(2.1618, "", group = "Fibonacci Levels", inline = "Level04")
col09 = input.color(#81c784, "", group = "Fibonacci Levels", inline = "Level04")
shw10 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level04")
val10 = input.float(3.618, "", group = "Fibonacci Levels", inline = "Level04")
col10 = input.color(#f44336, "", group = "Fibonacci Levels", inline = "Level04")
shw11 = input.bool(true, "", group = "Fibonacci Levels", inline = "Level05")
val11 = input.float(4.236, "", group = "Fibonacci Levels", inline = "Level05")
col11 = input.color(#809ef0, "", group = "Fibonacci Levels", inline = "Level05")
shw12 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level05")
val12 = input.float(1.272, "", group = "Fibonacci Levels", inline = "Level05")
col12 = input.color(#2962ff, "", group = "Fibonacci Levels", inline = "Level05")
shw13 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level06")
val13 = input.float(1.414, "", group = "Fibonacci Levels", inline = "Level06")
col13 = input.color(#e97527, "", group = "Fibonacci Levels", inline = "Level06")
shw14 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level06")
val14 = input.float(2.272, "", group = "Fibonacci Levels", inline = "Level06")
col14 = input.color(#f44336, "", group = "Fibonacci Levels", inline = "Level06")
shw15 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level07")
val15 = input.float(2.414, "", group = "Fibonacci Levels", inline = "Level07")
col15 = input.color(#9c27b0, "", group = "Fibonacci Levels", inline = "Level07")
shw16 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level07")
val16 = input.float(2.0, "", group = "Fibonacci Levels", inline = "Level07")
col16 = input.color(#b54df1, "", group = "Fibonacci Levels", inline = "Level07")
shw17 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level08")
val17 = input.float(3.0, "", group = "Fibonacci Levels", inline = "Level08")
col17 = input.color(#e91e63, "", group = "Fibonacci Levels", inline = "Level08")
shw18 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level08")
val18 = input.float(3.272, "", group = "Fibonacci Levels", inline = "Level08")
col18 = input.color(#81c784, "", group = "Fibonacci Levels", inline = "Level08")
shw19 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level09")
val19 = input.float(3.414, "", group = "Fibonacci Levels", inline = "Level09")
col19 = input.color(#f44336, "", group = "Fibonacci Levels", inline = "Level09")
shw20 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level09")
val20 = input.float(4.0, "", group = "Fibonacci Levels", inline = "Level09")
col20 = input.color(#81c784, "", group = "Fibonacci Levels", inline = "Level09")
shw21 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level10")
val21 = input.float(4.272, "", group = "Fibonacci Levels", inline = "Level10")
col21 = input.color(#009688, "", group = "Fibonacci Levels", inline = "Level10")
shw22 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level10")
val22 = input.float(4.414, "", group = "Fibonacci Levels", inline = "Level10")
col22 = input.color(#436d87, "", group = "Fibonacci Levels", inline = "Level10")
shw23 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level11")
val23 = input.float(4.618, "", group = "Fibonacci Levels", inline = "Level11")
col23 = input.color(#002396, "", group = "Fibonacci Levels", inline = "Level11")
shw24 = input.bool(false, "", group = "Fibonacci Levels", inline = "Level11")
val24 = input.float(4.764, "", group = "Fibonacci Levels", inline = "Level11")
col24 = input.color(#006696, "", group = "Fibonacci Levels", inline = "Level11")
// |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
// | CALCULATION |
// |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
// ++++++++++++ Supertrend Indicator
[super, dirc] = ta.supertrend(factor88, supAtr)
var intlSupr = float(na), var rangSupr = float(na)
intlSupr := dirc != dirc[1] ? super : intlSupr
rangSupr := dirc != dirc[1] ? math.abs(super - super[1]) : rangSupr
// ++++++++++++ Calculate Fib Levels Function
fibLev(x) => intlSupr + (dirc == -1 ? rangSupr : - rangSupr) * x
levFib(x) => (x - intlSupr)/ (dirc == -1 ? rangSupr : - rangSupr)
// ++++++++++++ Entered Fibonacci Levels
var usVal = array.new<float>(na)
var usCol = array.new<color>(na)
usValFun(val, col, flg) =>
if flg
array.push(usVal, val)
array.push(usCol, col)
if barstate.isfirst
usValFun(val01, col01, shw01), usValFun(val02, col02, shw02), usValFun(val03, col03, shw03),
usValFun(val04, col04, shw04), usValFun(val05, col05, shw05), usValFun(val06, col06, shw06),
usValFun(val07, col07, shw07), usValFun(val08, col08, shw08), usValFun(val09, col09, shw09),
usValFun(val10, col10, shw10), usValFun(val11, col11, shw11), usValFun(val12, col12, shw12),
usValFun(val13, col13, shw13), usValFun(val14, col14, shw14), usValFun(val15, col15, shw15),
usValFun(val16, col16, shw16), usValFun(val17, col17, shw17), usValFun(val18, col18, shw18),
usValFun(val19, col19, shw19), usValFun(val20, col20, shw20), usValFun(val21, col21, shw21),
usValFun(val22, col22, shw22), usValFun(val23, col23, shw23), usValFun(val24, col24, shw24),
inVal = array.new<float>(na)
for i = 0 to array.size(usVal) - 1
array.push(inVal, fibLev(array.get(usVal, i)))
array.sort(inVal, dirc < 1 ? order.ascending : order.descending)
// |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
// | DRAWING |
// |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
// ++++++++++++ Get Line Style
styLine(s) =>
switch s
"..........." => line.style_dotted
"-----------" => line.style_dashed
"________" => line.style_solid
// ++++++++++++ Get Line Extention
extLine(l) =>
switch l
"Right Extend" => extend.right
"Left Extend" => extend.left
"Both Extend" => extend.both
=> extend.none
// ++++++++++++ Get Text Label
txtLab(x) =>
prt1 = str.contains(lblSty, "Percent") ? str.tostring(levFib(x) * 100, format.percent) + " ":
str.contains(lblSty, "Value" ) ? str.tostring(levFib(x) , "#.###") + " " : ""
prt2 = str.contains(lblSty, "Price") ? "(" + str.tostring(x, format.mintick) + ")" : ""
(dirc > 0 ? " \n" : "") + prt1 + prt2 + (dirc < 0 ? " \n" : "")
// ++++++++++++ Line Function
linFunc(x1, y, x2, col) =>
line.new(x1, y, x2, y, xloc.bar_index, extLine(linExt), color.new(col, lnTrans), styLine(linSty), linSiz)
// ++++++++++++ Label Function
labFun(y, col) =>
label.new(bar_index, y, txtLab(y), color = color.new(col, 100), size = str.lower(lblSiz),
textcolor = col, style = label.style_label_left, textalign = text.align_left)
// ++++++++++++ Drawing Levels
var runUp = array.new<float>(na) // Collect RunUp Fib
var linArr = array.new<line>(na)
var labArr = array.new<label>(na)
line trnd = na
var trndBr = 0
if array.size(inVal) > 0
if dirc != dirc[1]
if confrim ? barstate.isconfirmed : true
if lastSet
line.delete(trnd[trndBr])
while array.size(linArr) > 0
line.delete(array.shift(linArr))
while array.size(labArr) > 0
label.delete(array.shift(labArr))
else
if array.size(linArr) > 0
for i = 0 to array.size(linArr) - 1
line.set_extend(array.get(linArr, i), extend.none)
if array.size(labArr) > 0
for i = 0 to array.size(labArr) - 1
label.set_style(array.get(labArr, i), label.style_label_right)
array.clear(linArr)
array.clear(labArr)
array.unshift(runUp, levFib(close))
trndBr := 0
for i = 0 to array.size(inVal) - 1
if not na(array.get(inVal, i))
linCol = array.get(usCol, array.indexof(usVal, levFib(array.get(inVal, i))))
// Line
if linExt != "Hide"
array.push(linArr, linFunc(bar_index, array.get(inVal, i), bar_index, linCol))
if array.size(linArr) > 1
linefill.new(array.get(linArr, array.size(linArr)-2),
array.get(linArr, array.size(linArr)-1),
color.new(linCol, bgTrans))
if trndChk and trndBr == 0
trnd := line.new(bar_index, fibLev(1), bar_index, super,
xloc.bar_index, extend.none, trndCol, line.style_dashed, 1)
trndBr := 1
// Label
if lblPos != "Hide"
array.push(labArr, labFun(array.get(inVal, i), linCol))
else
if array.size(runUp) > 0
runUpLast = array.get(runUp, 0)
runUpSrc = dirc == -1 ? high : low
array.set(runUp, 0, runUpLast > levFib(runUpSrc) ? runUpLast : levFib(runUpSrc))
if array.size(linArr) > 0
for i = 0 to array.size(linArr) - 1
line.set_x2(array.get(linArr, i), bar_index)
if array.size(labArr) > 0
for i = 0 to array.size(labArr) - 1
label.set_x(array.get(labArr, i), bar_index)
if trndChk
line.set_x2(trnd[trndBr], bar_index)
trndBr += 1
// Supertrend Plots and Signals
//upTrend = plot(pltChk and dirc < 0 ? super : na, "Up Trend", upCol, 3, plot.style_linebr)
//downTrend = plot(pltChk and dirc > 0 ? super : na, "Down Trend", dnCol, 3, plot.style_linebr)
//plotshape(pltChk and dirc < 0 and dirc != dirc[1] ? super : na, "Long", shape.labelup, location.absolute, upCol, 0, "LONG", color.white, display = display.pane, size = size.small)
//plotshape(pltChk and dirc > 0 and dirc != dirc[1] ? super : na, "Short", shape.labeldown, location.absolute, dnCol, 0, "SHORT", color.white, display = display.pane, size = size.small)
// |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
// | STATISTICS |
// |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[1] Table
// Get Tbale Location & Size
locNsze(x) =>
y = str.split(str.lower(x), " ")
out = ""
for i = 0 to array.size(y) - 1
out := out + array.get(y, i)
if i != array.size(y) - 1
out := out + "_"
out
// Create Table
var tbl = table.new(tablePos != "Hide" ? locNsze(tablePos) : position.top_right, 2, array.size(usVal) + 8,
frame_width = 1, frame_color = color.new(tBgCol, 100), border_width = 1, border_color = color.new(tBgCol, 100))
perFib(x) =>
str.contains(lblSty, "Percent") ? str.tostring(x * 100, format.percent) : str.tostring(x, "#.###")
// Cell Function
cell(col, row, txt, color) =>
table.cell(tbl, col, row, text = txt, text_color = txtCol, bgcolor = color,
text_size = size.small)
// Stats Cells
applyCell(row, des, val) =>
cell(0, row , des, tBgCol), table.merge_cells(tbl, 0, row, 1, row)
cell(0, row +1, val, cBgCol), table.merge_cells(tbl, 0, row +1, 1, row +1)
if barstate.islast and array.size(runUp) > 0 and tablePos != "Hide"
fibVal = array.copy(usVal)
array.sort(fibVal, order.descending)
mtx = matrix.new<float>(array.size(fibVal), 2, 0)
matrix.add_col(mtx, 0, fibVal)
totRunUp = array.size(runUp)
for i = 0 to totRunUp - 1
runup = array.get(runUp, i)
for j = 0 to matrix.rows(mtx) - 1
if not(runup < matrix.get(mtx, j, 0))
matrix.set(mtx, j, 1, matrix.get(mtx, j, 1) + 1)
matrix.set(mtx, j, 2, math.round(matrix.get(mtx, j, 1)/totRunUp * 100, 2))
break
// Table
if array.size(fibVal) > 0
table.clear(tbl, 0, 0, 1, array.size(usVal)+7)
y = 0
cell(0, y, "Historical", tBgCol), table.merge_cells(tbl, 0, 0, 1, 0)
y += 1
cell(0, y, "Fibonacci", tBgCol)
cell(1, y, "RunUP (%)", tBgCol)
y += 1
for i = 0 to matrix.rows(mtx) - 1
fib = matrix.get(mtx, i, 0)
if fib >= 1
Col = array.get(usCol, array.indexof(usVal, fib))
cell(0, y, perFib(fib) , Col)
cell(1, y, str.tostring(matrix.get(mtx, i, 2), format.percent), Col)
y+=1
// Separator
table.cell(tbl, 0, y, height = 2), table.merge_cells(tbl, 0, y, 1, y),
y += 1
applyCell(y, "Number of Trades", str.tostring(array.size(runUp)))
y += 2
applyCell(y, "Median Fib RunUp", perFib(array.median(runUp)))
y += 2
applyCell(y, "Mean Fib RunUp", perFib(array.avg(runUp)))
////////////////////////
16.07.2024 - 10.12.2024
16.07.2024 - 10.12.2024
https://tr.tradingview.com/script/Ai...Target-Levels/
fibo krlmlar....
https://www.tradingview.com/x/zifJFm8I/
ilk fibo hesaplanm hali birletirildi....PHP Code://@version=5
indicator("deneme", overlay = true, max_lines_count = 500, max_labels_count = 500, format=format.price)
////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// peacefulLizard50262
//@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, float 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
// Chebyshev Type II Moving Average
chebyshevII(float src, float len, float ripple) =>
a = 0.
b = 0.
g = 0.
chebyshev = 0.
a := cosh(1 / len * acosh(1 / ripple))
b := sinh(1 / len * asinh(ripple))
g := (a - b) / (a + b)
chebyshev := (1 - g) * src + g * nz(chebyshev[1], src)
chebyshev
chebyshev(float src, float length, float ripple, bool style) =>
style ?
chebyshevI(src, length, ripple) :
chebyshevII(src, length, ripple)
source44 = input.source(hl2, "Source")
up_color = input.color(color.new(color.green, 20), "Up Color")
down_color = input.color(color.new(color.red, 20), "Down Color")
text_color = input.color(color.black, "Text Color")
mean_length = input.float(24, "Mean Length", 5, 1000, 0.5)
mean_ripple = input.float(0.5, "Mean Ripple", 0.01, 0.99, 0.01)
style44 = input.bool(false, "True Chebyshev I | False : Chebyshev II")
atr_style = input.bool(true, "True: |Open-Close| False: High-Low")
atr_length = input.float(64, "ATR Length", 6, 1000, 0.5)
atr_ripple = input.float(0.05, "Mean Ripple", 0.01, 0.99, 0.01)
multiplier = input.float(1.5, "Multiplier", 0.125, 10, 0.125)
alerts = input.bool(false, "Alerts")
labels = input.bool(true, "Labels")
atr = chebyshev(atr_style ? high - low : math.abs(open - close), atr_length, atr_ripple, style44)
mean = chebyshevI(source44, mean_length, mean_ripple)
var float offset = 0.0
var bool state = na
var float newOffset = 0.0
crossover = ta.crossover(source44, offset)
position = source44 > offset
crossunder = ta.crossunder(source44, offset)
prevOffset = nz(offset[1])
if crossover[2] and position[1] and position or (position and position[1] and position[2])
newOffset := mean - atr * multiplier
offset := newOffset < nz(prevOffset) or close[1] > nz(prevOffset) ? newOffset : nz(prevOffset)
state := true
if crossunder[2] and not position[1] and not position or (not position and not position[1] and not position[2])
newOffset := mean + atr * multiplier
offset := newOffset > nz(prevOffset) or close[1] < nz(prevOffset) ? newOffset : nz(prevOffset)
state := false
cross = ta.cross(close, offset)
down_trend = not state and not state[1]
up_trend = state and state[1]
colour = up_trend ? up_color : down_trend ? down_color : color.new(color.white, 100)
if up_trend and not up_trend[1] and labels
label.new(bar_index, offset, "Up Trend \n" + str.tostring(close), color = up_color, style = label.style_label_up, textcolor = text_color)
alert("Up Trend at " + str.tostring(close))
else
alert("Up Trend at " + str.tostring(close))
if down_trend and not down_trend[1] and labels
label.new(bar_index, offset, "Down Trend \n" + str.tostring(close), color = down_color, style = label.style_label_down, textcolor = text_color)
alert("Down Trend at " + str.tostring(close))
else
alert("Down Trend at " + str.tostring(close))
plot(offset, "Trend", colour, style = plot.style_stepline_diamond)
plotshape(cross, "Trend Is Getting Ready To Change", shape.xcross, location.belowbar, color = close > offset ? up_color : down_color)
////////////////////////////////////////////
/// Creator: Tim Tillson (T3 Moving Average)
// Author: @dg_factor [09.12.2021]
// UYARI :
// Gelitirme amaldr. Risk ynetimi olmakszn alm-satm stratejisi yerine ikame edilemez.
// AIKLAMALAR
// Orijinal hasaplamalara sadk kalnarak farkl derecelerde (1-5) binom almlar uyguland.
// EMA dahil, toplamda yedi farkl hareketli ortalama tr zerinde alabilen dinamik bir yap ina edildi.
// Derece ve ortalama tr, opsiyonel birer parametre olarak kullanc tercihine sunuldu.
// Dier detaylar en aada.
//@version=5
// Inputs
src = close
length = input(title='Length', defval=20)
factor = input.float(title='Factor', defval=0.7, step=0.1)
degree = input.int(title='Degree', minval=1, maxval=5, defval=3, tooltip='1-5', group="DEGREE & TYPE")
ma_type = input.string(title="Type", defval="EMA", options=["EMA", "RMA", "EVMA", "GAUS", "HULLT", "MCGD", "TSF"], group="DEGREE & TYPE")
// MA Functions
// EVMA [Elastic Volume Weighted Moving Average]
f_evma(data, u1) =>
x = ta.sma(data, u1)
a = math.sum(volume, u1)
r = 0.0
r := na(r[1]) ? x : nz(r[1]) * (a - volume) / a + volume * data / a
//
// GAUS [Ehlers - Gaussian Filter]
f_gaus(data, u1) =>
a = (1 - math.cos(2 * math.pi / u1)) / (math.sqrt(2) - 1)
b = -a + math.sqrt(math.pow(a, 2) + 2 * a)
r = 0.0
r := na(r[1]) ? data : math.pow(b, 2) * data + 2 * (1 - b) * nz(r[1]) - math.pow(1 - b, 2) * nz(r[2])
//
// HULLT [Triple Hull Moving Average]
f_hullt(data, u1) =>
a = u1 < 3 ? 1 : u1 / 2
b = u1 < 3 ? 1 : u1 / 3
r = ta.wma(ta.wma(data, b) * 3 - ta.wma(data, a) - ta.wma(data, u1), u1)
//
// MCGD [McGinley Dynamic Moving Average]
f_mcgd(data, u1) =>
a = ta.ema(data, u1)
r = 0.0
r := na(r[1]) ? a : r[1] + (data - r[1]) / (u1 * math.pow(data / r[1], 4))
//
// TSF [Time Series Function]
f_tsf(data, u1) =>
2 * ta.linreg(data, u1, 0) - ta.linreg(data, u1, 1)
// MA Return
f_ma(data, u1) =>
ma_type == "EMA" ? ta.ema(data, u1) :
ma_type == "EVMA" ? f_evma(data, u1) :
ma_type == "GAUS" ? f_gaus(data, u1) :
ma_type == "HULLT" ? f_hullt(data, u1) :
ma_type == "MCGD" ? f_mcgd(data, u1) :
ma_type == "RMA" ? ta.rma(data, u1) :
ma_type == "TSF" ? f_tsf(data, u1) :
na
//
// Variables
x = factor
y = factor + 1
z = f_ma(src, length)
n = f_ma(z, length)
// Degreed Tillson MA Functions
d1(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
b0 = -1 * 1 * math.pow(x, 1) * math.pow(y, 0)
b1 = +1 * 1 * math.pow(x, 0) * math.pow(y, 1)
r = b0 * a1 + b1 * a0
//
d2(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
b0 = +1 * 1 * math.pow(x, 2) * math.pow(y, 0)
b1 = -1 * 2 * math.pow(x, 1) * math.pow(y, 1)
b2 = +1 * 1 * math.pow(x, 0) * math.pow(y, 2)
r = b0 * a2 + b1 * a1 + b2 * a0
//
d3(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
b0 = -1 * 1 * math.pow(x, 3) * math.pow(y, 0)
b1 = +1 * 3 * math.pow(x, 2) * math.pow(y, 1)
b2 = -1 * 3 * math.pow(x, 1) * math.pow(y, 2)
b3 = +1 * 1 * math.pow(x, 0) * math.pow(y, 3)
r = b0 * a3 + b1 * a2 + b2 * a1 + b3 * a0
//
d4(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
a4 = f_ma(a3, length)
b0 = +1 * 1 * math.pow(x, 4) * math.pow(y, 0)
b1 = -1 * 4 * math.pow(x, 3) * math.pow(y, 1)
b2 = +1 * 6 * math.pow(x, 2) * math.pow(y, 2)
b3 = -1 * 4 * math.pow(x, 1) * math.pow(y, 3)
b4 = +1 * 1 * math.pow(x, 0) * math.pow(y, 4)
r = b0 * a4 + b1 * a3 + b2 * a2 + b3 * a1 + b4 * a0
//
d5(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
a4 = f_ma(a3, length)
a5 = f_ma(a4, length)
b0 = -1 * 1 * math.pow(x, 5) * math.pow(y, 0)
b1 = +1 * 5 * math.pow(x, 4) * math.pow(y, 1)
b2 = -1 * 10 * math.pow(x, 3) * math.pow(y, 2)
b3 = +1 * 10 * math.pow(x, 2) * math.pow(y, 3)
b4 = -1 * 5 * math.pow(x, 1) * math.pow(y, 4)
b5 = +1 * 1 * math.pow(x, 0) * math.pow(y, 5)
r = b0 * a5 + b1 * a4 + b2 * a3 + b3 * a2 + b4 * a1 + b5 * a0
//
// Out
out =
degree == 1 ? d1(src, length) :
degree == 2 ? d2(src, length) :
degree == 3 ? d3(src, length) :
degree == 4 ? d4(src, length) :
degree == 5 ? d5(src, length) :
na
//
plot(out, color=#3082a500, title='Tillson MA')
barcolor(out > out[1] ? #00bb00 : out < out[1] ? #bb0000 : #333333)
// Bitti
//plotshape(barstate.isfirst, title="@ dg_factor", color=#13172200, editable=false)
// DETAYLAR
// T3'teki "3" nedir?
// T3 Moving Average, i ie kurgulanm ssel hareketli ortalamalarn nc dereceden binom alm alnarak hesaplanr.
// T3 eklinde adlandrlmasnn nedeni budur.
// Ufak bir matematiksel mdahale ile farkl dereceler kodlanabilir, netekim bu indikatr yntem olarak arpanlara ayrma nermektedir.
// mer Hayyam'n mevzuyla ne ilgisi var?
// Binom alm, Pascal geni olarak bilinen bir tamsay dizisine dayanr.
// smi Pascal'la anlsa da, bu gensel say dizisinin ilk olarak mer Hayyam'n hesaplamalarnda tanmland kabul edilir.
// Pascal geninin kartezyen toplamlar kullanlarak Fibonacci dizisini elde etmek de mmkndr.
// Yaylm rntlerini aklamadaki gc bakmndan Pascal geni ska kullanlan bir argmandr.
// zetle finansal algoritmalar Hayyam'a ok ey borludur.
// Ne ie yarayacak?
// Bama bir i gelmeyecekse;
// Trendi genellikle yakalar, ama terste brakma ihtimali de yksektir. Risk ynetimi bu yzden gerekli.
// Farkl dereceler fiyat frekansn retebilecek yntemlere katk sunabilir.
// Hatta ortalamaya ait nceki tepe ve diplerin yeni sinyal yn iin geerli destek/diren seviyeleri olarak alt da oluyor.
// Tabi herhangi bir ie yaramayabilir de :).
////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Baby_whale_to_moon
//@version=5
// BACKTEST DATE
Start_Time = input.time(defval=timestamp('01 January 2017 13:30 +0000'), title='Start_Time', group = " ################# BACKTEST DATE ################ " )
End_Time = input.time(defval=timestamp('30 April 2024 19:30 +0000'), title='End_Time', group = " ################# BACKTEST DATE ################ " )
// supertrend
atrPeriod = input(10, 'ATR Length', group = " ################# Supertrend ################ ")
factor77 = input(3, 'Factor', group = " ################# Supertrend ################ ")
time1 = input.string(title='Short Time Period', defval='07 1h', options=['01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our short-time supertrend indicator")
time2 = input.string(title='Long Time Period', defval='10 4h', options=[ '01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our long-time supertrend indicator")
res(Resolution) =>
if Resolution == '00 Current'
timeframe.period
else
if Resolution == '01 1m'
'1'
else
if Resolution == '02 3m'
'3'
else
if Resolution == '03 5m'
'5'
else
if Resolution == '04 15m'
'15'
else
if Resolution == '05 30m'
'30'
else
if Resolution == '06 45m'
'45'
else
if Resolution == '07 1h'
'60'
else
if Resolution == '08 2h'
'120'
else
if Resolution == '09 3h'
'180'
else
if Resolution == '10 4h'
'240'
else
if Resolution == '11 1D'
'1D'
else
if Resolution == '12 1W'
'1W'
else
if Resolution == '13 1M'
'1M'
// supertrend Long time period
[supertrend2, direction2] = request.security(syminfo.tickerid, res(time2), ta.supertrend(factor77, atrPeriod))
bodyMiddle4 = plot((open + close) / 2, display=display.none)
upTrend2 = plot(direction2 < 0 ? supertrend2 : na, 'seans up', color=color.new(#4caf4f, 100), style=plot.style_linebr, linewidth=2)
downTrend2 = plot(direction2 < 0 ? na : supertrend2, 'seans Down', color=color.new(#ff5252, 100), style=plot.style_linebr, linewidth=2)
// supertrend short time period
[supertrend1, direction1] = request.security(syminfo.tickerid, res(time1), ta.supertrend(factor77, atrPeriod))
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction1 < 0 ? supertrend1 : na, 'saat Up ', color=color.new(#ffeb3b, 100), style=plot.style_linebr)
downTrend = plot(direction1 < 0 ? na : supertrend1, 'saat Down ', color=color.new(#ff9900, 100), style=plot.style_linebr)
// Stochastic RSI
low_limit_stoch_rsi = input.float(title = 'Stoch Rsi Low Limit', step=0.5, defval=15, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossover Low Limit value we get Long")
up_limit_stoch_rsi = input.float(title = 'Stoch Rsi Up Limit', step=0.5, defval=85, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossunder Up Limit value we get Short")
stocrsi_back_length = input.int(20, 'Stoch Rsi retroactive length', minval=1, group = " ################# Stoch RSI ################ ", tooltip = "How many candles are left behind, even if there is a buy or sell signal, it will be valid now")
smoothK = input.int(3, 'Stochastic RSI K', minval=1, group = " ################# Stoch RSI ################ ")
lengthRSI = input.int(14, 'RSI Length', minval=1, group = " ################# Stoch RSI ################ ")
lengthStoch = input.int(14, 'Stochastic Length', minval=1, group = " ################# Stoch RSI ################ ")
src_rsi = input(close, title='RSI Source', group = " ################# Stoch RSI ################ ")
rsi1 = request.security(syminfo.tickerid, '240', ta.rsi(src_rsi, lengthRSI))
k = request.security(syminfo.tickerid, '240', ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK))
////////////////////////////////////////
//@version=5
//Variables//
var int breakOutLevelWidth = input.int(1,"Live Breakout Level Width: ")
var bool disableMovingLines = input.bool(true, "Disable Fibonnaci Extension Bands: ")
var int lookBack = input.int(3,"Lookback Period")
var float firstLevel = input.float(1.618, "Level 1")
var float secondLevel = input.float(2.277, "Level 2")
var float thirdLevel = input.float(3.0, "Level 3")
//var float fourthLevel = input.float(3.618, "Level 4")
//var float fifthLevel = input.float(4.418, "Level 5")
High(len,fibRate) =>
total = ta.highest(len) - ta.lowest(len)
total2 = total * fibRate
FIBExtension = total2 + ta.lowest(len)
Low(len,fibRate) =>
total = ta.highest(len) - ta.lowest(len)
total2 = total * fibRate
FIBExtension = ta.highest(len) - total2
// Plot Fibonacci extension levels from the lookback period
firstLevelPlotHigh = plot(disableMovingLines == false ? High(lookBack,firstLevel) : na, color=color.rgb(45, 168, 55), title="Level 1 High", linewidth=1)
firstLevelPlotLow = plot(disableMovingLines == false ? Low(lookBack,firstLevel) : na, color=color.rgb(45, 168, 55), title="Level 1 Low", linewidth=1)
secondLevelPlotHigh= plot(disableMovingLines == false ? High(lookBack,secondLevel) : na, color=color.rgb(23, 122, 28), title="Level 2 High", linewidth=1)
secondLevelPlotLow = plot(disableMovingLines == false ? Low(lookBack,secondLevel) : na, color=color.rgb(23, 122, 28), title="Level 2 Low", linewidth=1)
thirdLevelPlotHigh = plot(disableMovingLines == false ? High(lookBack,thirdLevel) : na, color=color.rgb(238, 234, 29), title="Level 3 High", linewidth=1)
thirdLevelPlotLow = plot(disableMovingLines == false ? Low(lookBack,thirdLevel) : na , color=color.rgb(238, 234, 29), title="Level 3 Low", linewidth=1)
//fourthLevelPlotHigh =plot(disableMovingLines == false ? High(lookBack,fourthLevel) : na, color=color.rgb(235, 159, 19), title="Level 4 High", linewidth=1)
//fourthLevelPlotLow = plot(disableMovingLines == false ? Low(lookBack,fourthLevel) : na, color=color.rgb(235, 159, 19), title="Level 4 Low", linewidth=1)
//fifthLevelPlotHigh = plot(disableMovingLines == false ? High(lookBack,fifthLevel) : na, color=color.rgb(221, 30, 30), title="Level 5 High", linewidth=1)
//fifthLevelPlotLow = plot(disableMovingLines == false ? Low(lookBack,fifthLevel) : na, color=color.rgb(221, 30, 30), title="Level 5 Low", linewidth=1)
//Horizontal TP Lines
var float hi1 = na
var float lo1 = na
var float hi2 = na
var float lo2 = na
var float hi3 = na
var float lo3 = na
//var float hi4 = na
//var float lo4 = na
//var float hi5 = na
//var float lo5 = na
var line firstLevelHighLine = na
var line firstLevelLowLine = na
var line secondLevelHighLine = na
var line secondLevelLowLine= na
var line thirdLevelHighLine = na
var line thirdLevelLowLine = na
//var line fourthLevelHighLine = na
//var line fourthLevelLowLine = na
//var line fifthLevelHighLine = na
//var line fifthLevelLowLine = na
if close
//Cleaning up the graph from the past lines
line.delete(firstLevelHighLine)
line.delete(firstLevelLowLine)
line.delete(secondLevelHighLine)
line.delete(secondLevelLowLine)
line.delete(thirdLevelHighLine)
line.delete(thirdLevelLowLine)
//line.delete(fourthLevelHighLine)
//line.delete(fourthLevelLowLine)
//line.delete(fifthLevelHighLine)
//line.delete(fifthLevelLowLine)
//////////////////////////
hi1 := High(lookBack,firstLevel)
lo1 := Low(lookBack, firstLevel)
hi2 := High(lookBack,secondLevel)
lo2 := Low(lookBack, secondLevel)
hi3 := High(lookBack,thirdLevel)
lo3 := Low(lookBack, thirdLevel)
//hi4 := High(lookBack,fourthLevel)
//lo4 := Low(lookBack, fourthLevel)
//hi5 := High(lookBack,fifthLevel)
//lo5 := Low(lookBack, fifthLevel)
//////////////////////////
firstLevelHighLine := line.new(bar_index + 10,hi1,bar_index,hi1,extend = extend.left,color = color.rgb(45, 168, 55),width = breakOutLevelWidth)
firstLevelLowLine := line.new(bar_index + 10,lo1,bar_index,lo1,extend = extend.left,color = color.rgb(45, 168, 55),width = breakOutLevelWidth)
secondLevelHighLine := line.new(bar_index + 10,hi2,bar_index,hi2,extend = extend.left,color = color.rgb(23, 122, 28),width = breakOutLevelWidth)
secondLevelLowLine := line.new(bar_index + 10,lo2,bar_index,lo2,extend = extend.left,color = color.rgb(23, 122, 28),width = breakOutLevelWidth)
thirdLevelHighLine := line.new(bar_index + 10,hi3,bar_index,hi3,extend = extend.left,color = color.rgb(238, 234, 29),width = breakOutLevelWidth)
thirdLevelLowLine := line.new(bar_index + 10,lo3,bar_index,lo3,extend = extend.left,color = color.rgb(238, 234, 29),width = breakOutLevelWidth)
//fourthLevelHighLine := line.new(bar_index + 10,hi4,bar_index,hi4,extend = extend.left,color = color.rgb(235, 159, 19),width = breakOutLevelWidth)
//fourthLevelLowLine := line.new(bar_index + 10,lo4,bar_index,lo4,extend = extend.left,color = color.rgb(235, 159, 19),width = breakOutLevelWidth)
//fifthLevelHighLine := line.new(bar_index + 10,hi5,bar_index,hi5,extend = extend.left,color = color.rgb(221, 30, 30),width = breakOutLevelWidth)
//fifthLevelLowLine := line.new(bar_index + 10,lo5,bar_index,lo5,extend = extend.left,color = color.rgb(221, 30, 30),width = breakOutLevelWidth)
////////////////////
16.07.2024 - 10.12.2024
https://tr.tradingview.com/script/H9...en-Close-Line/
ohlc cizgiler belirlenen zaman ii....
https://www.tradingview.com/x/YvD7zIQq/
16.07.2024 - 10.12.2024
https://tr.tradingview.com/script/o3MCXWkD/
3 ortalamay.....isterseniz 5-20-50 gibi belirlediiniz deerle kessiim bakarsnz....
isterseniz...5 uzunluun...saat-seanas-gnlk kesiim bakarsnz...
https://www.tradingview.com/x/0E9dF6z2/
bu da sade hali....https://www.tradingview.com/x/o9Rz4fXD/
kodun 5 uzunluk iin saat-seanas-gn mtf hali....60-240-720 diye yazdrld....
PHP Code://@version=5
indicator("deneme", overlay = true, max_lines_count = 500, max_labels_count = 500, format=format.price)
////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// peacefulLizard50262
//@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, float 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
// Chebyshev Type II Moving Average
chebyshevII(float src, float len, float ripple) =>
a = 0.
b = 0.
g = 0.
chebyshev = 0.
a := cosh(1 / len * acosh(1 / ripple))
b := sinh(1 / len * asinh(ripple))
g := (a - b) / (a + b)
chebyshev := (1 - g) * src + g * nz(chebyshev[1], src)
chebyshev
chebyshev(float src, float length, float ripple, bool style) =>
style ?
chebyshevI(src, length, ripple) :
chebyshevII(src, length, ripple)
source44 = input.source(hl2, "Source")
up_color = input.color(color.new(color.green, 20), "Up Color")
down_color = input.color(color.new(color.red, 20), "Down Color")
text_color = input.color(color.black, "Text Color")
mean_length = input.float(24, "Mean Length", 5, 1000, 0.5)
mean_ripple = input.float(0.5, "Mean Ripple", 0.01, 0.99, 0.01)
style44 = input.bool(false, "True Chebyshev I | False : Chebyshev II")
atr_style = input.bool(true, "True: |Open-Close| False: High-Low")
atr_length = input.float(64, "ATR Length", 6, 1000, 0.5)
atr_ripple = input.float(0.05, "Mean Ripple", 0.01, 0.99, 0.01)
multiplier = input.float(1.5, "Multiplier", 0.125, 10, 0.125)
alerts = input.bool(false, "Alerts")
labels = input.bool(true, "Labels")
atr = chebyshev(atr_style ? high - low : math.abs(open - close), atr_length, atr_ripple, style44)
mean = chebyshevI(source44, mean_length, mean_ripple)
var float offset = 0.0
var bool state = na
var float newOffset = 0.0
crossover = ta.crossover(source44, offset)
position = source44 > offset
crossunder = ta.crossunder(source44, offset)
prevOffset = nz(offset[1])
if crossover[2] and position[1] and position or (position and position[1] and position[2])
newOffset := mean - atr * multiplier
offset := newOffset < nz(prevOffset) or close[1] > nz(prevOffset) ? newOffset : nz(prevOffset)
state := true
if crossunder[2] and not position[1] and not position or (not position and not position[1] and not position[2])
newOffset := mean + atr * multiplier
offset := newOffset > nz(prevOffset) or close[1] < nz(prevOffset) ? newOffset : nz(prevOffset)
state := false
cross = ta.cross(close, offset)
down_trend = not state and not state[1]
up_trend = state and state[1]
colour = up_trend ? up_color : down_trend ? down_color : color.new(color.white, 100)
if up_trend and not up_trend[1] and labels
label.new(bar_index, offset, "Up Trend \n" + str.tostring(close), color = up_color, style = label.style_label_up, textcolor = text_color)
alert("Up Trend at " + str.tostring(close))
else
alert("Up Trend at " + str.tostring(close))
if down_trend and not down_trend[1] and labels
label.new(bar_index, offset, "Down Trend \n" + str.tostring(close), color = down_color, style = label.style_label_down, textcolor = text_color)
alert("Down Trend at " + str.tostring(close))
else
alert("Down Trend at " + str.tostring(close))
plot(offset, "Trend", colour, style = plot.style_stepline_diamond)
plotshape(cross, "Trend Is Getting Ready To Change", shape.xcross, location.belowbar, color = close > offset ? up_color : down_color)
////////////////////////////////////////////
/// Creator: Tim Tillson (T3 Moving Average)
// Author: @dg_factor [09.12.2021]
// UYARI :
// Gelitirme amaldr. Risk ynetimi olmakszn alm-satm stratejisi yerine ikame edilemez.
// AIKLAMALAR
// Orijinal hasaplamalara sadk kalnarak farkl derecelerde (1-5) binom almlar uyguland.
// EMA dahil, toplamda yedi farkl hareketli ortalama tr zerinde alabilen dinamik bir yap ina edildi.
// Derece ve ortalama tr, opsiyonel birer parametre olarak kullanc tercihine sunuldu.
// Dier detaylar en aada.
//@version=5
// Inputs
src = close
length = input(title='Length', defval=20)
factor = input.float(title='Factor', defval=0.7, step=0.1)
degree = input.int(title='Degree', minval=1, maxval=5, defval=3, tooltip='1-5', group="DEGREE & TYPE")
ma_type = input.string(title="Type", defval="EMA", options=["EMA", "RMA", "EVMA", "GAUS", "HULLT", "MCGD", "TSF"], group="DEGREE & TYPE")
// MA Functions
// EVMA [Elastic Volume Weighted Moving Average]
f_evma(data, u1) =>
x = ta.sma(data, u1)
a = math.sum(volume, u1)
r = 0.0
r := na(r[1]) ? x : nz(r[1]) * (a - volume) / a + volume * data / a
//
// GAUS [Ehlers - Gaussian Filter]
f_gaus(data, u1) =>
a = (1 - math.cos(2 * math.pi / u1)) / (math.sqrt(2) - 1)
b = -a + math.sqrt(math.pow(a, 2) + 2 * a)
r = 0.0
r := na(r[1]) ? data : math.pow(b, 2) * data + 2 * (1 - b) * nz(r[1]) - math.pow(1 - b, 2) * nz(r[2])
//
// HULLT [Triple Hull Moving Average]
f_hullt(data, u1) =>
a = u1 < 3 ? 1 : u1 / 2
b = u1 < 3 ? 1 : u1 / 3
r = ta.wma(ta.wma(data, b) * 3 - ta.wma(data, a) - ta.wma(data, u1), u1)
//
// MCGD [McGinley Dynamic Moving Average]
f_mcgd(data, u1) =>
a = ta.ema(data, u1)
r = 0.0
r := na(r[1]) ? a : r[1] + (data - r[1]) / (u1 * math.pow(data / r[1], 4))
//
// TSF [Time Series Function]
f_tsf(data, u1) =>
2 * ta.linreg(data, u1, 0) - ta.linreg(data, u1, 1)
// MA Return
f_ma(data, u1) =>
ma_type == "EMA" ? ta.ema(data, u1) :
ma_type == "EVMA" ? f_evma(data, u1) :
ma_type == "GAUS" ? f_gaus(data, u1) :
ma_type == "HULLT" ? f_hullt(data, u1) :
ma_type == "MCGD" ? f_mcgd(data, u1) :
ma_type == "RMA" ? ta.rma(data, u1) :
ma_type == "TSF" ? f_tsf(data, u1) :
na
//
// Variables
x = factor
y = factor + 1
z = f_ma(src, length)
n = f_ma(z, length)
// Degreed Tillson MA Functions
d1(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
b0 = -1 * 1 * math.pow(x, 1) * math.pow(y, 0)
b1 = +1 * 1 * math.pow(x, 0) * math.pow(y, 1)
r = b0 * a1 + b1 * a0
//
d2(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
b0 = +1 * 1 * math.pow(x, 2) * math.pow(y, 0)
b1 = -1 * 2 * math.pow(x, 1) * math.pow(y, 1)
b2 = +1 * 1 * math.pow(x, 0) * math.pow(y, 2)
r = b0 * a2 + b1 * a1 + b2 * a0
//
d3(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
b0 = -1 * 1 * math.pow(x, 3) * math.pow(y, 0)
b1 = +1 * 3 * math.pow(x, 2) * math.pow(y, 1)
b2 = -1 * 3 * math.pow(x, 1) * math.pow(y, 2)
b3 = +1 * 1 * math.pow(x, 0) * math.pow(y, 3)
r = b0 * a3 + b1 * a2 + b2 * a1 + b3 * a0
//
d4(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
a4 = f_ma(a3, length)
b0 = +1 * 1 * math.pow(x, 4) * math.pow(y, 0)
b1 = -1 * 4 * math.pow(x, 3) * math.pow(y, 1)
b2 = +1 * 6 * math.pow(x, 2) * math.pow(y, 2)
b3 = -1 * 4 * math.pow(x, 1) * math.pow(y, 3)
b4 = +1 * 1 * math.pow(x, 0) * math.pow(y, 4)
r = b0 * a4 + b1 * a3 + b2 * a2 + b3 * a1 + b4 * a0
//
d5(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
a4 = f_ma(a3, length)
a5 = f_ma(a4, length)
b0 = -1 * 1 * math.pow(x, 5) * math.pow(y, 0)
b1 = +1 * 5 * math.pow(x, 4) * math.pow(y, 1)
b2 = -1 * 10 * math.pow(x, 3) * math.pow(y, 2)
b3 = +1 * 10 * math.pow(x, 2) * math.pow(y, 3)
b4 = -1 * 5 * math.pow(x, 1) * math.pow(y, 4)
b5 = +1 * 1 * math.pow(x, 0) * math.pow(y, 5)
r = b0 * a5 + b1 * a4 + b2 * a3 + b3 * a2 + b4 * a1 + b5 * a0
//
// Out
out =
degree == 1 ? d1(src, length) :
degree == 2 ? d2(src, length) :
degree == 3 ? d3(src, length) :
degree == 4 ? d4(src, length) :
degree == 5 ? d5(src, length) :
na
//
plot(out, color=#3082a500, title='Tillson MA')
barcolor(out > out[1] ? #00bb00 : out < out[1] ? #bb0000 : #333333)
// Bitti
//plotshape(barstate.isfirst, title="@ dg_factor", color=#13172200, editable=false)
// DETAYLAR
// T3'teki "3" nedir?
// T3 Moving Average, i ie kurgulanm ssel hareketli ortalamalarn nc dereceden binom alm alnarak hesaplanr.
// T3 eklinde adlandrlmasnn nedeni budur.
// Ufak bir matematiksel mdahale ile farkl dereceler kodlanabilir, netekim bu indikatr yntem olarak arpanlara ayrma nermektedir.
// mer Hayyam'n mevzuyla ne ilgisi var?
// Binom alm, Pascal geni olarak bilinen bir tamsay dizisine dayanr.
// smi Pascal'la anlsa da, bu gensel say dizisinin ilk olarak mer Hayyam'n hesaplamalarnda tanmland kabul edilir.
// Pascal geninin kartezyen toplamlar kullanlarak Fibonacci dizisini elde etmek de mmkndr.
// Yaylm rntlerini aklamadaki gc bakmndan Pascal geni ska kullanlan bir argmandr.
// zetle finansal algoritmalar Hayyam'a ok ey borludur.
// Ne ie yarayacak?
// Bama bir i gelmeyecekse;
// Trendi genellikle yakalar, ama terste brakma ihtimali de yksektir. Risk ynetimi bu yzden gerekli.
// Farkl dereceler fiyat frekansn retebilecek yntemlere katk sunabilir.
// Hatta ortalamaya ait nceki tepe ve diplerin yeni sinyal yn iin geerli destek/diren seviyeleri olarak alt da oluyor.
// Tabi herhangi bir ie yaramayabilir de :).
////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Baby_whale_to_moon
//@version=5
// BACKTEST DATE
Start_Time = input.time(defval=timestamp('01 January 2017 13:30 +0000'), title='Start_Time', group = " ################# BACKTEST DATE ################ " )
End_Time = input.time(defval=timestamp('30 April 2024 19:30 +0000'), title='End_Time', group = " ################# BACKTEST DATE ################ " )
// supertrend
atrPeriod = input(10, 'ATR Length', group = " ################# Supertrend ################ ")
factor77 = input(3, 'Factor', group = " ################# Supertrend ################ ")
time1 = input.string(title='Short Time Period', defval='07 1h', options=['01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our short-time supertrend indicator")
time2 = input.string(title='Long Time Period', defval='10 4h', options=[ '01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our long-time supertrend indicator")
res(Resolution) =>
if Resolution == '00 Current'
timeframe.period
else
if Resolution == '01 1m'
'1'
else
if Resolution == '02 3m'
'3'
else
if Resolution == '03 5m'
'5'
else
if Resolution == '04 15m'
'15'
else
if Resolution == '05 30m'
'30'
else
if Resolution == '06 45m'
'45'
else
if Resolution == '07 1h'
'60'
else
if Resolution == '08 2h'
'120'
else
if Resolution == '09 3h'
'180'
else
if Resolution == '10 4h'
'240'
else
if Resolution == '11 1D'
'1D'
else
if Resolution == '12 1W'
'1W'
else
if Resolution == '13 1M'
'1M'
// supertrend Long time period
[supertrend2, direction2] = request.security(syminfo.tickerid, res(time2), ta.supertrend(factor77, atrPeriod))
bodyMiddle4 = plot((open + close) / 2, display=display.none)
upTrend2 = plot(direction2 < 0 ? supertrend2 : na, 'seans up', color=color.new(#4caf4f, 100), style=plot.style_linebr, linewidth=2)
downTrend2 = plot(direction2 < 0 ? na : supertrend2, 'seans Down', color=color.new(#ff5252, 100), style=plot.style_linebr, linewidth=2)
// supertrend short time period
[supertrend1, direction1] = request.security(syminfo.tickerid, res(time1), ta.supertrend(factor77, atrPeriod))
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction1 < 0 ? supertrend1 : na, 'saat Up ', color=color.new(#ffeb3b, 100), style=plot.style_linebr)
downTrend = plot(direction1 < 0 ? na : supertrend1, 'saat Down ', color=color.new(#ff9900, 100), style=plot.style_linebr)
// Stochastic RSI
low_limit_stoch_rsi = input.float(title = 'Stoch Rsi Low Limit', step=0.5, defval=15, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossover Low Limit value we get Long")
up_limit_stoch_rsi = input.float(title = 'Stoch Rsi Up Limit', step=0.5, defval=85, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossunder Up Limit value we get Short")
stocrsi_back_length = input.int(20, 'Stoch Rsi retroactive length', minval=1, group = " ################# Stoch RSI ################ ", tooltip = "How many candles are left behind, even if there is a buy or sell signal, it will be valid now")
smoothK = input.int(3, 'Stochastic RSI K', minval=1, group = " ################# Stoch RSI ################ ")
lengthRSI = input.int(14, 'RSI Length', minval=1, group = " ################# Stoch RSI ################ ")
lengthStoch = input.int(14, 'Stochastic Length', minval=1, group = " ################# Stoch RSI ################ ")
src_rsi = input(close, title='RSI Source', group = " ################# Stoch RSI ################ ")
rsi1 = request.security(syminfo.tickerid, '240', ta.rsi(src_rsi, lengthRSI))
k = request.security(syminfo.tickerid, '240', ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK))
////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Moller1_
//@version=5
//// --------------------------------------------------------------------------
//// Triple Moving Averages and Timeframes ------------------------------------
ma_group_1 = 'Triple MA and TF 1'
ma_plot_1 = input.bool(true, 'Plot MA 1', group=ma_group_1)
ma_chart_type_1 = input.string('Standard', 'Tipo de grfico', group= ma_group_1,
options =['Standard', 'Heikin Ashi', 'Kagi', 'Line Break', 'Point & Figure', 'Renko'])
ma_timeframe_1 = input.timeframe('60', 'MA 1 TF', group=ma_group_1)
ma_source_1 = input.source(high, 'MA 1 Source', group=ma_group_1)
ma_variable_1 = input.string('EMA', title='MA 1 Type',
options=['EMA', 'SMA', 'WMA', 'VWMA', 'SWMA', 'SMMA', 'DEMA', 'RMA' ,'HMA', 'TEMA', 'THMA', 'EHMA', 'Donchian', 'TMA', 'LSMA', 'McGinley', 'COVWMA', 'FRAMA', 'VIDYA', 'KAMA', 'ZEMA'], group=ma_group_1)
ma_len_1 = input.int(5, title='MA 1 Len', step=5, group=ma_group_1)
ma_group_2 = 'Triple MA and TF 2'
ma_plot_2 = input.bool(true, 'Plot MA 2', group=ma_group_2)
ma_chart_type_2 = input.string('Standard', 'Tipo de grfico', group= ma_group_2,
options =['Standard', 'Heikin Ashi', 'Kagi', 'Line Break', 'Point & Figure', 'Renko'])
ma_timeframe_2 = input.timeframe('240', 'MA 2 TF', group=ma_group_2)
ma_source_2 = input.source(high, 'MA 2 Source', group=ma_group_2)
ma_variable_2 = input.string('EMA', title='MA 2 Type',
options=['EMA', 'SMA', 'WMA', 'VWMA', 'SWMA', 'SMMA', 'DEMA', 'RMA' ,'HMA', 'TEMA', 'THMA', 'EHMA', 'Donchian', 'TMA', 'LSMA', 'McGinley', 'COVWMA', 'FRAMA', 'VIDYA', 'KAMA', 'ZEMA'], group=ma_group_2)
ma_len_2 = input.int(5, title='MA 2 Len', step=5, group=ma_group_2)
ma_group_3 = 'Triple MA and TF 3'
ma_plot_3 = input.bool(true, 'Plot MA 3', group=ma_group_3)
ma_chart_type_3 = input.string('Standard', 'Tipo de grfico', group= ma_group_3,
options =['Standard', 'Heikin Ashi', 'Kagi', 'Line Break', 'Point & Figure', 'Renko'])
ma_timeframe_3 = input.timeframe('720', 'MA 3 TF', group=ma_group_3)
ma_source_3 = input.source(high, 'MA 3 Source', group=ma_group_3)
ma_variable_3 = input.string('EMA', title='MA 3 Type',
options=['EMA', 'SMA', 'WMA', 'VWMA', 'SWMA', 'SMMA', 'DEMA', 'RMA' ,'HMA', 'TEMA', 'THMA', 'EHMA', 'Donchian', 'TMA', 'LSMA', 'McGinley', 'COVWMA', 'FRAMA', 'VIDYA', 'KAMA', 'ZEMA'], group=ma_group_3)
ma_len_3 = input.int(5, title='MA 3 Len', step=5, group=ma_group_3)
//// ------------------------------------------------------------------
//// Functions
//// Non-Standard Charts
chart(chart)=>
switch chart
'Heikin Ashi' => ticker.heikinashi(syminfo.tickerid)
'Standard' => ticker.standard(syminfo.tickerid)
'Kagi' => ticker.kagi(syminfo.tickerid, 3)
'Line Break' => ticker.linebreak(syminfo.tickerid, 3)
'Point & Figure'=> ticker.pointfigure(syminfo.tickerid, "hl", "Traditional", 1, 3)
'Renko' => ticker.renko(syminfo.tickerid, "ATR", 10)
// Chande Momentum Oscillator
FuncCMO(_src, _period) =>
tmpMomentum = ta.change(_src)
tmpSummaryUp = math.sum(math.max(tmpMomentum, 0), _period)
tmpSummaryDown = math.sum(-math.min(tmpMomentum, 0), _period)
math.abs((tmpSummaryUp - tmpSummaryDown) / (tmpSummaryUp + tmpSummaryDown))
// Fractal Adaptive Moving Average (FRAMA)
FuncFRAMA(_src, _period) =>
_coefficient = -4.6
_n3 = (ta.highest(high, _period) - ta.lowest(low, _period)) / _period
_hd2 = ta.highest(high, _period / 2)
_ld2 = ta.lowest(low, _period / 2)
_n2 = (_hd2 - _ld2) / (_period / 2)
_n1 = (_hd2[_period / 2] - _ld2[_period / 2]) / (_period / 2)
_dim = _n1 > 0 and _n2 > 0 and _n3 > 0 ? (math.log(_n1 + _n2) - math.log(_n3)) / math.log(2) : 0
_alpha = math.exp(_coefficient * (_dim - 1))
_sc = _alpha < 0.01 ? 0.01 : _alpha > 1 ? 1 : _alpha
ta.cum(1) <= 2 * _period ? _src : _src * _sc + nz(_src[1]) * (1 - _sc)
// Variable Index Dynamic Average (VIDYA)
FuncVIDYA(_src, _period) =>
cmo = FuncCMO(_src, _period)
alpha = 2 / (_period + 1)
vidya = 0.0
vidya := _src * alpha * cmo + nz(vidya[1]) * (1 - alpha * cmo)
vidya
// Kaufman's Adaptive Moving Average (KAMA)
FuncKAMA(_src, _period) =>
tmpVal = 0.0
sum_1 = math.sum(math.abs(_src - _src[1]), _period)
sum_2 = math.sum(math.abs(_src - _src[1]), _period)
tmpVal := nz(tmpVal[1]) + math.pow((sum_1 != 0 ? math.abs(_src - _src[_period]) / sum_2 : 0) * (0.666 - 0.0645) + 0.0645, 2) * (_src - nz(tmpVal[1]))
tmpVal
// ZEMA
FuncZEMA(src, len) =>
lag = (len - 1) / 2
emaSrc = src + src - src[lag]
v10 = ta.ema(emaSrc, len)
v10
// export ma_calculate(string variable_ma = 'EMA', float source, simple int len)=>
ma_calculate(variable_ma = 'EMA', source, len)=>
float smma = na
float mg = na
switch variable_ma
'EMA' => ta.ema(source, len)
'SMA' => ta.sma(source, len)
'WMA' => ta.wma(source, len)
'VWMA' => ta.vwma(source, len)
'SWMA' => ta.swma(source)
'SMMA' => na(smma[1]) ? ta.sma(source, len) : (smma[1] * (len - 1) + source) / len
'DEMA' => 2 * ta.ema(source, len) - ta.ema(ta.ema(source, len), len)
'RMA ' => ta.rma(source, len)
'HMA' => ta.hma(source, len)
'TEMA' => 3 * (ta.ema(source, len) - ta.ema(ta.ema(source, len), len)) + ta.ema(ta.ema(ta.ema(source, len), len), len)
'THMA' => (ta.wma(ta.wma(source,(len/2) / 3) * 3 - ta.wma(source, (len/2) / 2) - ta.wma(source, (len/2)), (len/2)))
'EHMA' => (ta.ema(2 * ta.ema(source, len / 2) - ta.ema(source, len), math.round(math.sqrt(len))))
'Donchian'=> ((math.avg(ta.lowest(len), ta.highest(len))) + (math.avg(ta.lowest(len/2), ta.highest(len/2))))/2
'TMA' => ta.sma(ta.sma(source, math.ceil(len / 2)), math.floor(len / 2) + 1)
'LSMA' => ta.linreg(source, len, 0)
'McGinley'=> na(mg[1]) ? ta.ema(source, len) : mg[1] + (source - mg[1]) / (len * math.pow(source / mg[1], 4))
// Coefficient of Variation Weighted Moving Average (COVWMA)
'COVWMA' => math.sum((source * (ta.stdev(source, len) / ta.sma(source, len))), len) / math.sum((ta.stdev(source, len) / ta.sma(source, len)), len)
'FRAMA' => FuncFRAMA(source, len)
'VIDYA' => FuncVIDYA(source, len)
'KAMA' => FuncKAMA(source, len)
'ZEMA' => FuncZEMA(source, len)
=>
runtime.error("No matching MA type found.")
float(na)
ma_1 = request.security(chart(ma_chart_type_1), ma_timeframe_1, ma_calculate(ma_variable_1, ma_source_1, ma_len_1))
ma_2 = request.security(chart(ma_chart_type_2), ma_timeframe_2, ma_calculate(ma_variable_2, ma_source_2, ma_len_2))
ma_3 = request.security(chart(ma_chart_type_3), ma_timeframe_3, ma_calculate(ma_variable_3, ma_source_3, ma_len_3))
plot(ma_plot_1? ma_1: na, '60', color = color.rgb(33, 149, 243, 100))
plot(ma_plot_2? ma_2: na, '240', color = color.rgb(255, 235, 59, 100))
plot(ma_plot_3? ma_3: na, '720', color = color.rgb(255, 255, 255, 100))
16.07.2024 - 10.12.2024
https://tr.tradingview.com/script/FT...versal-picker/
ok gzelmi...
14-200 smay rsi ile ilikilendirmi...
nce rsiyi...50 st ve alt ayrm...
sonra 19-21 smay...14 rside 65-35 ile ilikilendirmi....
bylece destek ve diren izdirmi....
https://www.tradingview.com/x/HAYhfHdk/
hayal edin....
bunu mom-sar-v.b ile ilikilendirilse....
izgiler...mom direnci....rsi direnci...sar direnci gibi oluacak...desteklerde yle...
zerinde almak lazm......
bu arada kod birletike....PHP Code://@version=5
indicator("deneme", overlay = true, max_lines_count = 500, max_labels_count = 500, format=format.price)
////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// peacefulLizard50262
//@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, float 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
// Chebyshev Type II Moving Average
chebyshevII(float src, float len, float ripple) =>
a = 0.
b = 0.
g = 0.
chebyshev = 0.
a := cosh(1 / len * acosh(1 / ripple))
b := sinh(1 / len * asinh(ripple))
g := (a - b) / (a + b)
chebyshev := (1 - g) * src + g * nz(chebyshev[1], src)
chebyshev
chebyshev(float src, float length, float ripple, bool style) =>
style ?
chebyshevI(src, length, ripple) :
chebyshevII(src, length, ripple)
source44 = input.source(hl2, "Source")
up_color = input.color(color.new(color.green, 20), "Up Color")
down_color = input.color(color.new(color.red, 20), "Down Color")
text_color = input.color(color.black, "Text Color")
mean_length = input.float(24, "Mean Length", 5, 1000, 0.5)
mean_ripple = input.float(0.5, "Mean Ripple", 0.01, 0.99, 0.01)
style44 = input.bool(false, "True Chebyshev I | False : Chebyshev II")
atr_style = input.bool(true, "True: |Open-Close| False: High-Low")
atr_length = input.float(64, "ATR Length", 6, 1000, 0.5)
atr_ripple = input.float(0.05, "Mean Ripple", 0.01, 0.99, 0.01)
multiplier = input.float(1.5, "Multiplier", 0.125, 10, 0.125)
alerts = input.bool(false, "Alerts")
labels = input.bool(true, "Labels")
atr = chebyshev(atr_style ? high - low : math.abs(open - close), atr_length, atr_ripple, style44)
mean = chebyshevI(source44, mean_length, mean_ripple)
var float offset = 0.0
var bool state = na
var float newOffset = 0.0
crossover = ta.crossover(source44, offset)
position = source44 > offset
crossunder = ta.crossunder(source44, offset)
prevOffset = nz(offset[1])
if crossover[2] and position[1] and position or (position and position[1] and position[2])
newOffset := mean - atr * multiplier
offset := newOffset < nz(prevOffset) or close[1] > nz(prevOffset) ? newOffset : nz(prevOffset)
state := true
if crossunder[2] and not position[1] and not position or (not position and not position[1] and not position[2])
newOffset := mean + atr * multiplier
offset := newOffset > nz(prevOffset) or close[1] < nz(prevOffset) ? newOffset : nz(prevOffset)
state := false
cross = ta.cross(close, offset)
down_trend = not state and not state[1]
up_trend = state and state[1]
colour = up_trend ? up_color : down_trend ? down_color : color.new(color.white, 100)
if up_trend and not up_trend[1] and labels
label.new(bar_index, offset, "Up Trend \n" + str.tostring(close), color = up_color, style = label.style_label_up, textcolor = text_color)
alert("Up Trend at " + str.tostring(close))
else
alert("Up Trend at " + str.tostring(close))
if down_trend and not down_trend[1] and labels
label.new(bar_index, offset, "Down Trend \n" + str.tostring(close), color = down_color, style = label.style_label_down, textcolor = text_color)
alert("Down Trend at " + str.tostring(close))
else
alert("Down Trend at " + str.tostring(close))
plot(offset, "Trend", colour, style = plot.style_stepline_diamond)
plotshape(cross, "Trend Is Getting Ready To Change", shape.xcross, location.belowbar, color = close > offset ? up_color : down_color)
////////////////////////////////////////////
/// Creator: Tim Tillson (T3 Moving Average)
// Author: @dg_factor [09.12.2021]
// UYARI :
// Gelitirme amaldr. Risk ynetimi olmakszn alm-satm stratejisi yerine ikame edilemez.
// AIKLAMALAR
// Orijinal hasaplamalara sadk kalnarak farkl derecelerde (1-5) binom almlar uyguland.
// EMA dahil, toplamda yedi farkl hareketli ortalama tr zerinde alabilen dinamik bir yap ina edildi.
// Derece ve ortalama tr, opsiyonel birer parametre olarak kullanc tercihine sunuldu.
// Dier detaylar en aada.
//@version=5
// Inputs
src = close
length = input(title='Length', defval=20)
factor = input.float(title='Factor', defval=0.7, step=0.1)
degree = input.int(title='Degree', minval=1, maxval=5, defval=3, tooltip='1-5', group="DEGREE & TYPE")
ma_type = input.string(title="Type", defval="EMA", options=["EMA", "RMA", "EVMA", "GAUS", "HULLT", "MCGD", "TSF"], group="DEGREE & TYPE")
// MA Functions
// EVMA [Elastic Volume Weighted Moving Average]
f_evma(data, u1) =>
x = ta.sma(data, u1)
a = math.sum(volume, u1)
r = 0.0
r := na(r[1]) ? x : nz(r[1]) * (a - volume) / a + volume * data / a
//
// GAUS [Ehlers - Gaussian Filter]
f_gaus(data, u1) =>
a = (1 - math.cos(2 * math.pi / u1)) / (math.sqrt(2) - 1)
b = -a + math.sqrt(math.pow(a, 2) + 2 * a)
r = 0.0
r := na(r[1]) ? data : math.pow(b, 2) * data + 2 * (1 - b) * nz(r[1]) - math.pow(1 - b, 2) * nz(r[2])
//
// HULLT [Triple Hull Moving Average]
f_hullt(data, u1) =>
a = u1 < 3 ? 1 : u1 / 2
b = u1 < 3 ? 1 : u1 / 3
r = ta.wma(ta.wma(data, b) * 3 - ta.wma(data, a) - ta.wma(data, u1), u1)
//
// MCGD [McGinley Dynamic Moving Average]
f_mcgd(data, u1) =>
a = ta.ema(data, u1)
r = 0.0
r := na(r[1]) ? a : r[1] + (data - r[1]) / (u1 * math.pow(data / r[1], 4))
//
// TSF [Time Series Function]
f_tsf(data, u1) =>
2 * ta.linreg(data, u1, 0) - ta.linreg(data, u1, 1)
// MA Return
f_ma(data, u1) =>
ma_type == "EMA" ? ta.ema(data, u1) :
ma_type == "EVMA" ? f_evma(data, u1) :
ma_type == "GAUS" ? f_gaus(data, u1) :
ma_type == "HULLT" ? f_hullt(data, u1) :
ma_type == "MCGD" ? f_mcgd(data, u1) :
ma_type == "RMA" ? ta.rma(data, u1) :
ma_type == "TSF" ? f_tsf(data, u1) :
na
//
// Variables
x = factor
y = factor + 1
z = f_ma(src, length)
n = f_ma(z, length)
// Degreed Tillson MA Functions
d1(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
b0 = -1 * 1 * math.pow(x, 1) * math.pow(y, 0)
b1 = +1 * 1 * math.pow(x, 0) * math.pow(y, 1)
r = b0 * a1 + b1 * a0
//
d2(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
b0 = +1 * 1 * math.pow(x, 2) * math.pow(y, 0)
b1 = -1 * 2 * math.pow(x, 1) * math.pow(y, 1)
b2 = +1 * 1 * math.pow(x, 0) * math.pow(y, 2)
r = b0 * a2 + b1 * a1 + b2 * a0
//
d3(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
b0 = -1 * 1 * math.pow(x, 3) * math.pow(y, 0)
b1 = +1 * 3 * math.pow(x, 2) * math.pow(y, 1)
b2 = -1 * 3 * math.pow(x, 1) * math.pow(y, 2)
b3 = +1 * 1 * math.pow(x, 0) * math.pow(y, 3)
r = b0 * a3 + b1 * a2 + b2 * a1 + b3 * a0
//
d4(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
a4 = f_ma(a3, length)
b0 = +1 * 1 * math.pow(x, 4) * math.pow(y, 0)
b1 = -1 * 4 * math.pow(x, 3) * math.pow(y, 1)
b2 = +1 * 6 * math.pow(x, 2) * math.pow(y, 2)
b3 = -1 * 4 * math.pow(x, 1) * math.pow(y, 3)
b4 = +1 * 1 * math.pow(x, 0) * math.pow(y, 4)
r = b0 * a4 + b1 * a3 + b2 * a2 + b3 * a1 + b4 * a0
//
d5(src, length) =>
a0 = f_ma(n, length)
a1 = f_ma(a0, length)
a2 = f_ma(a1, length)
a3 = f_ma(a2, length)
a4 = f_ma(a3, length)
a5 = f_ma(a4, length)
b0 = -1 * 1 * math.pow(x, 5) * math.pow(y, 0)
b1 = +1 * 5 * math.pow(x, 4) * math.pow(y, 1)
b2 = -1 * 10 * math.pow(x, 3) * math.pow(y, 2)
b3 = +1 * 10 * math.pow(x, 2) * math.pow(y, 3)
b4 = -1 * 5 * math.pow(x, 1) * math.pow(y, 4)
b5 = +1 * 1 * math.pow(x, 0) * math.pow(y, 5)
r = b0 * a5 + b1 * a4 + b2 * a3 + b3 * a2 + b4 * a1 + b5 * a0
//
// Out
out =
degree == 1 ? d1(src, length) :
degree == 2 ? d2(src, length) :
degree == 3 ? d3(src, length) :
degree == 4 ? d4(src, length) :
degree == 5 ? d5(src, length) :
na
//
plot(out, color=#3082a500, title='Tillson MA')
barcolor(out > out[1] ? #00bb00 : out < out[1] ? #bb0000 : #333333)
// Bitti
//plotshape(barstate.isfirst, title="@ dg_factor", color=#13172200, editable=false)
// DETAYLAR
// T3'teki "3" nedir?
// T3 Moving Average, i ie kurgulanm ssel hareketli ortalamalarn nc dereceden binom alm alnarak hesaplanr.
// T3 eklinde adlandrlmasnn nedeni budur.
// Ufak bir matematiksel mdahale ile farkl dereceler kodlanabilir, netekim bu indikatr yntem olarak arpanlara ayrma nermektedir.
// mer Hayyam'n mevzuyla ne ilgisi var?
// Binom alm, Pascal geni olarak bilinen bir tamsay dizisine dayanr.
// smi Pascal'la anlsa da, bu gensel say dizisinin ilk olarak mer Hayyam'n hesaplamalarnda tanmland kabul edilir.
// Pascal geninin kartezyen toplamlar kullanlarak Fibonacci dizisini elde etmek de mmkndr.
// Yaylm rntlerini aklamadaki gc bakmndan Pascal geni ska kullanlan bir argmandr.
// zetle finansal algoritmalar Hayyam'a ok ey borludur.
// Ne ie yarayacak?
// Bama bir i gelmeyecekse;
// Trendi genellikle yakalar, ama terste brakma ihtimali de yksektir. Risk ynetimi bu yzden gerekli.
// Farkl dereceler fiyat frekansn retebilecek yntemlere katk sunabilir.
// Hatta ortalamaya ait nceki tepe ve diplerin yeni sinyal yn iin geerli destek/diren seviyeleri olarak alt da oluyor.
// Tabi herhangi bir ie yaramayabilir de :).
////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Baby_whale_to_moon
//@version=5
// BACKTEST DATE
Start_Time = input.time(defval=timestamp('01 January 2017 13:30 +0000'), title='Start_Time', group = " ################# BACKTEST DATE ################ " )
End_Time = input.time(defval=timestamp('30 April 2024 19:30 +0000'), title='End_Time', group = " ################# BACKTEST DATE ################ " )
// supertrend
atrPeriod = input(10, 'ATR Length', group = " ################# Supertrend ################ ")
factor77 = input(3, 'Factor', group = " ################# Supertrend ################ ")
time1 = input.string(title='Short Time Period', defval='07 1h', options=['01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our short-time supertrend indicator")
time2 = input.string(title='Long Time Period', defval='10 4h', options=[ '01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our long-time supertrend indicator")
res(Resolution) =>
if Resolution == '00 Current'
timeframe.period
else
if Resolution == '01 1m'
'1'
else
if Resolution == '02 3m'
'3'
else
if Resolution == '03 5m'
'5'
else
if Resolution == '04 15m'
'15'
else
if Resolution == '05 30m'
'30'
else
if Resolution == '06 45m'
'45'
else
if Resolution == '07 1h'
'60'
else
if Resolution == '08 2h'
'120'
else
if Resolution == '09 3h'
'180'
else
if Resolution == '10 4h'
'240'
else
if Resolution == '11 1D'
'1D'
else
if Resolution == '12 1W'
'1W'
else
if Resolution == '13 1M'
'1M'
// supertrend Long time period
[supertrend2, direction2] = request.security(syminfo.tickerid, res(time2), ta.supertrend(factor77, atrPeriod))
bodyMiddle4 = plot((open + close) / 2, display=display.none)
upTrend2 = plot(direction2 < 0 ? supertrend2 : na, 'seans up', color=color.new(#4caf4f, 100), style=plot.style_linebr, linewidth=2)
downTrend2 = plot(direction2 < 0 ? na : supertrend2, 'seans Down', color=color.new(#ff5252, 100), style=plot.style_linebr, linewidth=2)
// supertrend short time period
[supertrend1, direction1] = request.security(syminfo.tickerid, res(time1), ta.supertrend(factor77, atrPeriod))
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction1 < 0 ? supertrend1 : na, 'saat Up ', color=color.new(#ffeb3b, 100), style=plot.style_linebr)
downTrend = plot(direction1 < 0 ? na : supertrend1, 'saat Down ', color=color.new(#ff9900, 100), style=plot.style_linebr)
// Stochastic RSI
low_limit_stoch_rsi = input.float(title = 'Stoch Rsi Low Limit', step=0.5, defval=15, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossover Low Limit value we get Long")
up_limit_stoch_rsi = input.float(title = 'Stoch Rsi Up Limit', step=0.5, defval=85, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossunder Up Limit value we get Short")
stocrsi_back_length = input.int(20, 'Stoch Rsi retroactive length', minval=1, group = " ################# Stoch RSI ################ ", tooltip = "How many candles are left behind, even if there is a buy or sell signal, it will be valid now")
smoothK = input.int(3, 'Stochastic RSI K', minval=1, group = " ################# Stoch RSI ################ ")
lengthRSI = input.int(14, 'RSI Length', minval=1, group = " ################# Stoch RSI ################ ")
lengthStoch = input.int(14, 'Stochastic Length', minval=1, group = " ################# Stoch RSI ################ ")
src_rsi = input(close, title='RSI Source', group = " ################# Stoch RSI ################ ")
rsi1 = request.security(syminfo.tickerid, '240', ta.rsi(src_rsi, lengthRSI))
k = request.security(syminfo.tickerid, '240', ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK))
////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Moller1_
//@version=5
//// --------------------------------------------------------------------------
//// Triple Moving Averages and Timeframes ------------------------------------
ma_group_1 = 'Triple MA and TF 1'
ma_plot_1 = input.bool(true, 'Plot MA 1', group=ma_group_1)
ma_chart_type_1 = input.string('Standard', 'Tipo de grfico', group= ma_group_1,
options =['Standard', 'Heikin Ashi', 'Kagi', 'Line Break', 'Point & Figure', 'Renko'])
ma_timeframe_1 = input.timeframe('60', 'MA 1 TF', group=ma_group_1)
ma_source_1 = input.source(high, 'MA 1 Source', group=ma_group_1)
ma_variable_1 = input.string('EMA', title='MA 1 Type',
options=['EMA', 'SMA', 'WMA', 'VWMA', 'SWMA', 'SMMA', 'DEMA', 'RMA' ,'HMA', 'TEMA', 'THMA', 'EHMA', 'Donchian', 'TMA', 'LSMA', 'McGinley', 'COVWMA', 'FRAMA', 'VIDYA', 'KAMA', 'ZEMA'], group=ma_group_1)
ma_len_1 = input.int(5, title='MA 1 Len', step=5, group=ma_group_1)
ma_group_2 = 'Triple MA and TF 2'
ma_plot_2 = input.bool(true, 'Plot MA 2', group=ma_group_2)
ma_chart_type_2 = input.string('Standard', 'Tipo de grfico', group= ma_group_2,
options =['Standard', 'Heikin Ashi', 'Kagi', 'Line Break', 'Point & Figure', 'Renko'])
ma_timeframe_2 = input.timeframe('240', 'MA 2 TF', group=ma_group_2)
ma_source_2 = input.source(high, 'MA 2 Source', group=ma_group_2)
ma_variable_2 = input.string('EMA', title='MA 2 Type',
options=['EMA', 'SMA', 'WMA', 'VWMA', 'SWMA', 'SMMA', 'DEMA', 'RMA' ,'HMA', 'TEMA', 'THMA', 'EHMA', 'Donchian', 'TMA', 'LSMA', 'McGinley', 'COVWMA', 'FRAMA', 'VIDYA', 'KAMA', 'ZEMA'], group=ma_group_2)
ma_len_2 = input.int(5, title='MA 2 Len', step=5, group=ma_group_2)
ma_group_3 = 'Triple MA and TF 3'
ma_plot_3 = input.bool(true, 'Plot MA 3', group=ma_group_3)
ma_chart_type_3 = input.string('Standard', 'Tipo de grfico', group= ma_group_3,
options =['Standard', 'Heikin Ashi', 'Kagi', 'Line Break', 'Point & Figure', 'Renko'])
ma_timeframe_3 = input.timeframe('720', 'MA 3 TF', group=ma_group_3)
ma_source_3 = input.source(high, 'MA 3 Source', group=ma_group_3)
ma_variable_3 = input.string('EMA', title='MA 3 Type',
options=['EMA', 'SMA', 'WMA', 'VWMA', 'SWMA', 'SMMA', 'DEMA', 'RMA' ,'HMA', 'TEMA', 'THMA', 'EHMA', 'Donchian', 'TMA', 'LSMA', 'McGinley', 'COVWMA', 'FRAMA', 'VIDYA', 'KAMA', 'ZEMA'], group=ma_group_3)
ma_len_3 = input.int(5, title='MA 3 Len', step=5, group=ma_group_3)
//// ------------------------------------------------------------------
//// Functions
//// Non-Standard Charts
chart(chart)=>
switch chart
'Heikin Ashi' => ticker.heikinashi(syminfo.tickerid)
'Standard' => ticker.standard(syminfo.tickerid)
'Kagi' => ticker.kagi(syminfo.tickerid, 3)
'Line Break' => ticker.linebreak(syminfo.tickerid, 3)
'Point & Figure'=> ticker.pointfigure(syminfo.tickerid, "hl", "Traditional", 1, 3)
'Renko' => ticker.renko(syminfo.tickerid, "ATR", 10)
// Chande Momentum Oscillator
FuncCMO(_src, _period) =>
tmpMomentum = ta.change(_src)
tmpSummaryUp = math.sum(math.max(tmpMomentum, 0), _period)
tmpSummaryDown = math.sum(-math.min(tmpMomentum, 0), _period)
math.abs((tmpSummaryUp - tmpSummaryDown) / (tmpSummaryUp + tmpSummaryDown))
// Fractal Adaptive Moving Average (FRAMA)
FuncFRAMA(_src, _period) =>
_coefficient = -4.6
_n3 = (ta.highest(high, _period) - ta.lowest(low, _period)) / _period
_hd2 = ta.highest(high, _period / 2)
_ld2 = ta.lowest(low, _period / 2)
_n2 = (_hd2 - _ld2) / (_period / 2)
_n1 = (_hd2[_period / 2] - _ld2[_period / 2]) / (_period / 2)
_dim = _n1 > 0 and _n2 > 0 and _n3 > 0 ? (math.log(_n1 + _n2) - math.log(_n3)) / math.log(2) : 0
_alpha = math.exp(_coefficient * (_dim - 1))
_sc = _alpha < 0.01 ? 0.01 : _alpha > 1 ? 1 : _alpha
ta.cum(1) <= 2 * _period ? _src : _src * _sc + nz(_src[1]) * (1 - _sc)
// Variable Index Dynamic Average (VIDYA)
FuncVIDYA(_src, _period) =>
cmo = FuncCMO(_src, _period)
alpha = 2 / (_period + 1)
vidya = 0.0
vidya := _src * alpha * cmo + nz(vidya[1]) * (1 - alpha * cmo)
vidya
// Kaufman's Adaptive Moving Average (KAMA)
FuncKAMA(_src, _period) =>
tmpVal = 0.0
sum_1 = math.sum(math.abs(_src - _src[1]), _period)
sum_2 = math.sum(math.abs(_src - _src[1]), _period)
tmpVal := nz(tmpVal[1]) + math.pow((sum_1 != 0 ? math.abs(_src - _src[_period]) / sum_2 : 0) * (0.666 - 0.0645) + 0.0645, 2) * (_src - nz(tmpVal[1]))
tmpVal
// ZEMA
FuncZEMA(src, len) =>
lag = (len - 1) / 2
emaSrc = src + src - src[lag]
v10 = ta.ema(emaSrc, len)
v10
// export ma_calculate(string variable_ma = 'EMA', float source, simple int len)=>
ma_calculate(variable_ma = 'EMA', source, len)=>
float smma = na
float mg = na
switch variable_ma
'EMA' => ta.ema(source, len)
'SMA' => ta.sma(source, len)
'WMA' => ta.wma(source, len)
'VWMA' => ta.vwma(source, len)
'SWMA' => ta.swma(source)
'SMMA' => na(smma[1]) ? ta.sma(source, len) : (smma[1] * (len - 1) + source) / len
'DEMA' => 2 * ta.ema(source, len) - ta.ema(ta.ema(source, len), len)
'RMA ' => ta.rma(source, len)
'HMA' => ta.hma(source, len)
'TEMA' => 3 * (ta.ema(source, len) - ta.ema(ta.ema(source, len), len)) + ta.ema(ta.ema(ta.ema(source, len), len), len)
'THMA' => (ta.wma(ta.wma(source,(len/2) / 3) * 3 - ta.wma(source, (len/2) / 2) - ta.wma(source, (len/2)), (len/2)))
'EHMA' => (ta.ema(2 * ta.ema(source, len / 2) - ta.ema(source, len), math.round(math.sqrt(len))))
'Donchian'=> ((math.avg(ta.lowest(len), ta.highest(len))) + (math.avg(ta.lowest(len/2), ta.highest(len/2))))/2
'TMA' => ta.sma(ta.sma(source, math.ceil(len / 2)), math.floor(len / 2) + 1)
'LSMA' => ta.linreg(source, len, 0)
'McGinley'=> na(mg[1]) ? ta.ema(source, len) : mg[1] + (source - mg[1]) / (len * math.pow(source / mg[1], 4))
// Coefficient of Variation Weighted Moving Average (COVWMA)
'COVWMA' => math.sum((source * (ta.stdev(source, len) / ta.sma(source, len))), len) / math.sum((ta.stdev(source, len) / ta.sma(source, len)), len)
'FRAMA' => FuncFRAMA(source, len)
'VIDYA' => FuncVIDYA(source, len)
'KAMA' => FuncKAMA(source, len)
'ZEMA' => FuncZEMA(source, len)
=>
runtime.error("No matching MA type found.")
float(na)
ma_1 = request.security(chart(ma_chart_type_1), ma_timeframe_1, ma_calculate(ma_variable_1, ma_source_1, ma_len_1))
ma_2 = request.security(chart(ma_chart_type_2), ma_timeframe_2, ma_calculate(ma_variable_2, ma_source_2, ma_len_2))
ma_3 = request.security(chart(ma_chart_type_3), ma_timeframe_3, ma_calculate(ma_variable_3, ma_source_3, ma_len_3))
plot(ma_plot_1? ma_1: na, '60', color = color.rgb(33, 149, 243, 100))
plot(ma_plot_2? ma_2: na, '240', color = color.rgb(255, 235, 59, 100))
plot(ma_plot_3? ma_3: na, '720', color = color.rgb(255, 255, 255, 100))
//////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Gudanin
//@version=5
//line variables
line1 = ta.sma(close, 14)
line2 = ta.sma(close, 200)
highrsi = ta.rsi(close,14) > 50
lowrsi = ta.rsi(close,14) < 50
line11 = ta.sma(close, 19)
line22 = ta.sma(close, 21)
highrsi1 = ta.rsi(close,14) >= 65
lowrsi1 = ta.rsi(close,14) <= 35
//Reversal logic
BuyP= line11 > line22 and highrsi1 and line1 > line2 and highrsi
var label up = na
var label down = na
var line l = na
var float first_close = na
var bool can_draw = false
var line l1 = na
var float first_close1 = na
var bool can_draw1 = false
//support and resistance line colors
color supportlinecolor = input.color(color.green, "Support line color")
color resistancelinecolor = input.color(color.red, "Resistance line color")
//label colors
color buylabelcolor = input.color(color.green, "Buy label color")
color selllabelcolor = input.color(color.red, "Sell label color")
//text colors
color buylabeltextcolor = input.color(color.white, "Buy label text color")
color selllabeltextcolor = input.color(color.white, "Sell label text color")
if(line11 > line22 and highrsi1 and line1 > line2 and highrsi)
first_close := close // Reset session high
can_draw := true // We are allowed to draw a line
l := line.new(bar_index-1, first_close, bar_index, first_close, color=resistancelinecolor, xloc = xloc.bar_index, extend = extend.both,width=2)
line.delete(l[1])
if(na(up)) //Does not exist, create one
up := label.new(bar_index, close, "fiyat dn \n diren", color=selllabelcolor, yloc=yloc.abovebar, textcolor = selllabeltextcolor)
else
label.set_x(up, bar_index)
if(line11 < line22 and lowrsi and line1 < line2 and lowrsi )
first_close1 := open // Reset session high
can_draw1 := true // We are allowed to draw a line
l1 := line.new(bar_index-1, first_close1, bar_index, first_close1, color=supportlinecolor, xloc = xloc.bar_index, extend = extend.both,width=2)
line.delete(l1[1])
if(na(down)) //Does not exist, create one
down := label.new(bar_index, close, "fiyat dn \n destek", color=buylabelcolor, yloc=yloc.belowbar, style = label.style_label_up, textcolor = buylabeltextcolor)
else
label.set_x(down, bar_index)
//////////////////////////////////////////////////
karmak olabilir.......
istemediiniz yeri silin.....versiyon yazan yerler blm halinde......
kodu yaynlayacaksanz.....
kesinlikle yazarna atfta bulunun.....
emee sayg.....![]()
16.07.2024 - 10.12.2024
Yer mleri