PHP Code:
//@version=6
indicator(title = 'deneme', shorttitle = '.', overlay = true, max_lines_count = 100, max_labels_count=100, max_boxes_count = 100, max_bars_back = 100)
//////////////////////////////////////////////////////////////////MTF SAR HESAPLAMASIDIR///////////////
start46 = input(0.)
increment46 = input(0.1)
maximum46 = input(0.9, "Max Value")
out55 = ta.sar(start46, increment46, maximum46)
plot_color = close > out55 ? color.rgb(5, 182, 64) : close < out55 ? color.rgb(169, 7, 7) : na
show_header = input(false, title="Show header?", group='Table Settings')
dashboard_position = input.string("Top center", title="Position", options=["Top right", "Top center", "Middle right"], group='Table Settings')
text_size = input.string('Normal', title="Size", options=["Tiny", "Small", "Normal", "Large"], group='Table Settings')
text_color = input.color(color.rgb(11, 68, 224), title="Text color", group='Table Settings')
table_color = input.color(color.purple, title="Border color", group='Table Settings')
uptrend_indicator = "🔵"
downtrend_indicator = "🟠"
tf11 = input.timeframe("1", title="Timeframe 1")
tf22 = input.timeframe("3", title="Timeframe 2")
tf33 = input.timeframe("5", title="Timeframe 3")
tf4 = input.timeframe("10", title="Timeframe 4")
tf5 = input.timeframe("15", title="Timeframe 5")
tf6 = input.timeframe("30", title="Timeframe 6")
tf7 = input.timeframe("60", title="Timeframe 7")
tf8 = input.timeframe("120", title="Timeframe 8")
tf9 = input.timeframe("240", title="Timeframe 9")
tf10 = input.timeframe("D", title="Timeframe 10")
var table_position = dashboard_position == 'Top center' ? position.middle_right :
dashboard_position == 'Top center' ? position.middle_right :
dashboard_position == 'Middle right' ? position.middle_right : position.middle_right
var table_text_size = text_size == 'Normal' ? size.normal :
text_size == 'Small' ? size.small : size.normal
var t = table.new(position=table_position, columns=3, rows=20, frame_color=#cdcbcb, frame_width=5, border_color=table_color, border_width=1,bgcolor =color.rgb(21, 21, 21) )
get_trend_status(trend_value) =>
is_uptrend = close > trend_value
candle_now = is_uptrend ? uptrend_indicator : downtrend_indicator
candle_now
//--------------------------------------------------------------------------------------
sar_1 = request.security(syminfo.tickerid, tf11, ta.sar(start46, increment46, maximum46))
sar_2 = request.security(syminfo.tickerid, tf22, ta.sar(start46, increment46, maximum46))
sar_3 = request.security(syminfo.tickerid, tf33, ta.sar(start46, increment46, maximum46))
sar_4 = request.security(syminfo.tickerid, tf4, ta.sar(start46, increment46, maximum46))
sar_5 = request.security(syminfo.tickerid, tf5, ta.sar(start46, increment46, maximum46))
sar_6 = request.security(syminfo.tickerid, tf6, ta.sar(start46, increment46, maximum46))
sar_7 = request.security(syminfo.tickerid, tf7, ta.sar(start46, increment46, maximum46))
sar_8 = request.security(syminfo.tickerid, tf8, ta.sar(start46, increment46, maximum46))
sar_9 = request.security(syminfo.tickerid, tf9, ta.sar(start46, increment46, maximum46))
sar_10 = request.security(syminfo.tickerid, tf10, ta.sar(start46, increment46, maximum46))
trend_indicator_1 = get_trend_status(sar_1)
trend_indicator_2 = get_trend_status(sar_2)
trend_indicator_3 = get_trend_status(sar_3)
trend_indicator_4 = get_trend_status(sar_4)
trend_indicator_5 = get_trend_status(sar_5)
trend_indicator_6 = get_trend_status(sar_6)
trend_indicator_7 = get_trend_status(sar_7)
trend_indicator_8 = get_trend_status(sar_8)
trend_indicator_9 = get_trend_status(sar_9)
trend_indicator_10 = get_trend_status(sar_10)
if tf11 == "60"
tf11 := "1H"
if tf11 == "120"
tf11 := "2H"
if tf11 == "180"
tf11 := "3H"
if tf11 == "240"
tf11 := "4H"
if tf22 == "60"
tf22 := "1H"
if tf22 == "120"
tf22 := "2H"
if tf22 == "180"
tf22 := "3H"
if tf22 == "240"
tf22 := "4H"
if tf33 == "60"
tf33 := "1H"
if tf33 == "120"
tf33 := "2H"
if tf33 == "180"
tf33 := "3H"
if tf33 == "240"
tf33 := "4H"
if tf4 == "60"
tf4 := "1H"
if tf4 == "120"
tf4 := "2H"
if tf4 == "180"
tf4 := "3H"
if tf4 == "240"
tf4 := "4H"
if tf5 == "60"
tf5 := "1H"
if tf5 == "120"
tf5 := "2H"
if tf5 == "180"
tf5 := "3H"
if tf5 == "240"
tf5 := "4H"
if tf6 == "60"
tf6 := "1H"
if tf6 == "120"
tf6 := "2H"
if tf6 == "180"
tf6 := "3H"
if tf6 == "240"
tf6 := "4H"
if tf7 == "60"
tf7 := "1H"
if tf7 == "120"
tf7 := "2H"
if tf7 == "180"
tf7 := "3H"
if tf7 == "240"
tf7 := "4H"
if tf8 == "60"
tf8 := "1H"
if tf8 == "120"
tf8 := "2H"
if tf8 == "180"
tf8 := "3H"
if tf8 == "240"
tf8 := "4H"
if tf9 == "60"
tf9 := "1H"
if tf9 == "120"
tf9 := "2H"
if tf9 == "180"
tf9 := "3H"
if tf9 == "240"
tf9 := "4H"
if tf10 == "60"
tf10 := "1H"
if tf10 == "120"
tf10 := "2H"
if tf10 == "180"
tf10 := "3H"
if tf10 == "240"
tf10 := "4H"
//---------------------------------------------------------------------------------------------
// Update table with trend data
//---------------------------------------------------------------------------------------------
if (barstate.islast)
table.cell(t, 0, 1, tf11, text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 1, 1, text="●", text_color=trend_indicator_1==uptrend_indicator?color.lime:color.red,text_size = size.large)
table.cell(t, 2, 1, str.tostring(sar_1, "#.##"), text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 0, 2, tf22, text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 1, 2, text="●", text_color=trend_indicator_2==uptrend_indicator?color.lime:color.red,text_size = size.large)
table.cell(t, 2, 2, str.tostring(sar_2, "#.##"), text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 0, 3, tf33, text_color=color.white, text_size=table_text_size,bgcolor= color.rgb(21, 21, 21))
table.cell(t, 1, 3, text="●", text_color=trend_indicator_3==uptrend_indicator?color.lime:color.red,text_size = size.large)
table.cell(t, 2, 3, str.tostring(sar_3, "#.##"), text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 0, 4, tf4, text_color=color.white, text_size=table_text_size, bgcolor = color.rgb(21, 21, 21))
table.cell(t, 1, 4, text="●", text_color=trend_indicator_4==uptrend_indicator?color.lime:color.red,text_size = size.large)
table.cell(t, 2, 4, str.tostring(sar_4, "#.##"), text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 0, 5, tf5, text_color=color.white, text_size=table_text_size, bgcolor = color.rgb(21, 21, 21))
table.cell(t, 1, 5, text="●", text_color=trend_indicator_5==uptrend_indicator?color.lime:color.red,text_size = size.large)
table.cell(t, 2, 5, str.tostring(sar_5, "#.##"), text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 0, 6, tf6, text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 1, 6, text="●", text_color=trend_indicator_6==uptrend_indicator?color.lime:color.red,text_size = size.large)
table.cell(t, 2, 6, str.tostring(sar_6, "#.##"), text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 0, 7, tf7, text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 1, 7, text="●", text_color=trend_indicator_7==uptrend_indicator?color.lime:color.red,text_size = size.large)
table.cell(t, 2, 7, str.tostring(sar_7, "#.##"), text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 0, 8, tf8, text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 1, 8, text="●", text_color=trend_indicator_8==uptrend_indicator?color.lime:color.red,text_size = size.large)
table.cell(t, 2, 8, str.tostring(sar_8, "#.##"), text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 0, 9, tf9, text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 1, 9, text="●", text_color=trend_indicator_9==uptrend_indicator?color.lime:color.red,text_size = size.large)
table.cell(t, 2, 9, str.tostring(sar_9, "#.##"), text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 0, 10, tf10, text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t, 1, 10, text="●", text_color=trend_indicator_10==uptrend_indicator?color.lime:color.red,text_size = size.large)
table.cell(t, 2, 10, str.tostring(sar_10, "#.##"), text_color=color.white, text_size=table_text_size,bgcolor = color.rgb(21, 21, 21))
table.cell(t,0,0,"Periyot",text_color = color.white,bgcolor = color.rgb(21, 21, 21))
table.cell(t,1,0,"Trend",text_color = color.white,bgcolor = color.rgb(21, 21, 21))
table.cell(t,2,0,"Fiyat",text_color = color.white,bgcolor = color.rgb(21, 21, 21))
lookback = input.int(5, "Line Lookback Period", minval=1)
//////////////////////
var params = "Parameters"
src55 = nz(input.source(close, title = "Source", group = params))
len55 = input.int(5, title = "ATR Len", group = params)
multi55 = input.float(1.5, title = "Multi", step = 0.25, minval = 0, group = params)
var cols = "Colors"
up_col = input.color(color.rgb(255, 255, 255, 00), title = "Yükseliş", group = cols)
down_col = input.color(color.rgb(247, 3, 3), title = "DÜşüş", group = cols)
flat_col = input.color(color.rgb(0, 0, 0, 00), title = "Flat ", inline = "3", group = cols)
rope_smoother(float _src55, float _threshold) =>
var float _rope = _src55
_move = _src55 - _rope //Movement from Rope
_rope += math.max(math.abs(_move) - nz(_threshold), 0) * math.sign(_move) //Directional Movement beyond the Threshold
[_rope,_rope+_threshold,_rope-_threshold] //[Rope, Upper, Lower]
///_____________________________________________________________________________________________________________________
//Calculating Rope
atr99 = ta.atr(len55)*multi55
[rope,upper,lower] = rope_smoother(src55,atr99)
//Directional Detection
var dir = 0
dir := rope > rope[1] ? 1 : rope < rope[1] ? -1 : dir
if ta.cross(src55,rope)
dir := 0
//Directional Color Assignment
col = dir > 0 ? up_col : dir < 0 ? down_col : flat_col
//High and Low Output Lines
var float c_hi = na
var float c_lo = na
//Counters for Accumulating Averages
var float h_sum = 0
var float l_sum = 0
var int c_count = 0
//Flip-Flop
var ff = 1
if dir == 0
if dir[1] != 0
h_sum := 0
l_sum := 0
c_count := 0
ff := ff * -1
h_sum += upper
l_sum += lower
c_count += 1
c_hi := h_sum/c_count
c_lo := l_sum/c_count
///
plot(rope, linewidth = 3, color = col, title = "ATR", force_overlay = true)
//////////////////////////////////////////////////////////////////////
groupFrames = 'Trend Monitoring Time Frames'
tf1 = input.timeframe('1', title='TF1 - Short', group=groupFrames)
tf2 = input.timeframe('5', title='TF2 - Medium', group=groupFrames)
tf3 = input.timeframe('15', title='TF3 - Long', group=groupFrames)
statusThreshold = input.int(4, title='Min Status Matches for Candle Color', options=[1, 2, 3, 4])
//-----------------------------------------
// User Inputs - Candle Color Settings
//-----------------------------------------
groupBody = 'Candle Color: Body'
sbBodyColor = input.color(color.white, title='KESİN AL', group=groupBody)
bullBodyColor = input.color(color.rgb(255, 255, 255, 100), title='AL', group=groupBody)
baseBodyColor = input.color(color.rgb(4, 4, 4), title='DİKKAT ET', group=groupBody)
bearBodyColor = input.color(color.rgb(255, 82, 82, 100), title='SAT', group=groupBody)
sbearBodyColor = input.color(color.rgb(255, 82, 82, 100), title='KESİN SAT', group=groupBody)
ghostBodyColor = input.color(color.rgb(223, 64, 251, 100), title='TREND YOK', group=groupBody)
groupBorder = 'Candle Color: Border & Wick'
sbBorderColor = input.color(color.white, title='KESİN AL', group=groupBorder)
bullBorderColor = input.color(color.rgb(255, 255, 255, 100), title='AL', group=groupBorder)
baseBorderColor = input.color(color.rgb(4, 4, 4), title='DİKKAT ET', group=groupBorder)
bearBorderColor = input.color(color.rgb(255, 82, 82, 100), title='SAT', group=groupBorder)
sbearBorderColor = input.color(color.rgb(255, 82, 82, 100), title='KESİN SAT', group=groupBorder)
ghostBorderColor = input.color(color.rgb(223, 64, 251, 100), title='TREND YOK', group=groupBorder)
//-----------------------------------------
// User Inputs - MACD Settings (at bottom per request)
//-----------------------------------------
groupMACD = 'MACD Settings'
macdFastLen = input.int(20, title='MACD Fast Length', minval=1, group=groupMACD)
macdSlowLen = input.int(40, title='MACD Slow Length', minval=1, group=groupMACD)
macdSignalLen = input.int(5, title='MACD Signal Smoothing', minval=1, group=groupMACD)
maType = input.string('EMA', title='MACD MA Type', options=['EMA', 'SMA', 'WMA'], group=groupMACD)
//-----------------------------------------
// MACD Calculation Function
//-----------------------------------------
calcMACD(_src, _fastLen, _slowLen, _signalLen) =>
fastMA = maType == 'EMA' ? ta.ema(_src, _fastLen) : maType == 'SMA' ? ta.sma(_src, _fastLen) : ta.wma(_src, _fastLen)
slowMA = maType == 'EMA' ? ta.ema(_src, _slowLen) : maType == 'SMA' ? ta.sma(_src, _slowLen) : ta.wma(_src, _slowLen)
macdValue = fastMA - slowMA
signalLine = maType == 'EMA' ? ta.ema(macdValue, _signalLen) : maType == 'SMA' ? ta.sma(macdValue, _signalLen) : ta.wma(macdValue, _signalLen)
hist = macdValue - signalLine
[macdValue, signalLine, hist, fastMA, slowMA]
//-----------------------------------------
// MACD (10m) Logic
//-----------------------------------------
[macdLine, signalLine, macdHist, _, _] = request.security(syminfo.tickerid, '10', calcMACD(close, macdFastLen, macdSlowLen, macdSignalLen))
macdBullish = macdLine > signalLine
macdStrong = macdBullish and macdLine > -0.25 and signalLine > -0.25
macdSuperBear = not macdBullish and macdLine < -0.25 and signalLine < -0.25
macdNeutral = not macdBullish and macdLine > -0.025 and signalLine > -0.025 and not macdSuperBear
macdText = macdStrong ? 'SUPERBULL' : macdSuperBear ? 'SUPERBEAR' : macdNeutral ? 'Basing' : macdBullish ? 'Bullish' : 'Bearish'
//-----------------------------------------
// Timeframe Status Function
//-----------------------------------------
f_getStatus(tf) =>
[smaHigh, smaLow] = request.security(syminfo.tickerid, tf, [ta.sma(high, 20), ta.sma(low, 20)])
[macdLine_tf, signalLine_tf, _, fastMA_tf, slowMA_tf] = request.security(syminfo.tickerid, tf, calcMACD(close, macdFastLen, macdSlowLen, macdSignalLen))
price_tf = request.security(syminfo.tickerid, tf, close)
macdBullish_tf = macdLine_tf > signalLine_tf
aboveSMAs = price_tf > smaHigh and price_tf > smaLow
belowSMAs = price_tf < smaHigh and price_tf < smaLow
belowMAs = macdLine_tf < fastMA_tf and signalLine_tf < slowMA_tf
status = ''
statusColor = color.gray
if aboveSMAs and macdBullish_tf and macdLine_tf > -0.025
status := 'SUPERBULL'
else if belowSMAs and not macdBullish_tf and macdLine_tf < -0.025 and belowMAs
status := 'SUPERBEAR'
else if macdLine_tf > -0.025 and not macdBullish_tf
status := 'Basing'
else if aboveSMAs and macdBullish_tf
status := 'Bullish'
else if not aboveSMAs and not macdBullish_tf
status := 'Bearish'
[status, statusColor]
//-----------------------------------------
// Timeframe Status Logic
//-----------------------------------------
[status1, color1] = f_getStatus(tf1)
[status5, color5] = f_getStatus(tf2)
[status15, color15] = f_getStatus(tf3)
//-----------------------------------------
// Status Match Count
//-----------------------------------------
superbullCount = (macdText == 'SUPERBULL' ? 1 : 0) + (status1 == 'SUPERBULL' ? 1 : 0) + (status5 == 'SUPERBULL' ? 1 : 0) + (status15 == 'SUPERBULL' ? 1 : 0)
superbearCount = (macdText == 'SUPERBEAR' ? 1 : 0) + (status1 == 'SUPERBEAR' ? 1 : 0) + (status5 == 'SUPERBEAR' ? 1 : 0) + (status15 == 'SUPERBEAR' ? 1 : 0)
basingCount = (macdText == 'Basing' ? 1 : 0) + (status1 == 'Basing' ? 1 : 0) + (status5 == 'Basing' ? 1 : 0) + (status15 == 'Basing' ? 1 : 0)
bullishCount = (macdText == 'Bullish' ? 1 : 0) + (status1 == 'Bullish' ? 1 : 0) + (status5 == 'Bullish' ? 1 : 0) + (status15 == 'Bullish' ? 1 : 0)
bearishCount = (macdText == 'Bearish' ? 1 : 0) + (status1 == 'Bearish' ? 1 : 0) + (status5 == 'Bearish' ? 1 : 0) + (status15 == 'Bearish' ? 1 : 0)
//-----------------------------------------
// Candle Coloring Logic
//-----------------------------------------
candleBodyColor = ghostBodyColor
candleBorderWickColor = ghostBorderColor
if superbullCount >= statusThreshold
candleBodyColor := sbBodyColor
candleBorderWickColor := sbBorderColor
else if superbearCount >= statusThreshold
candleBodyColor := sbearBodyColor
candleBorderWickColor := sbearBorderColor
else if basingCount >= statusThreshold
candleBodyColor := baseBodyColor
candleBorderWickColor := baseBorderColor
else if bullishCount >= statusThreshold
candleBodyColor := bullBodyColor
candleBorderWickColor := bullBorderColor
else if bearishCount >= statusThreshold
candleBodyColor := bearBodyColor
candleBorderWickColor := bearBorderColor
plotcandle(open, high, low, close,
title='BAR',
color=candleBodyColor,
bordercolor=candleBorderWickColor,
wickcolor=candleBorderWickColor)
//////////////////////////////////////////////////////
//@version=6
var table logo = table.new(position.bottom_center, 1, 1)
if barstate.islast
table.cell(logo, 0, 0, 'deneme eğitim çalışması kod birleştirme örneği ', text_size = size.normal, text_color = color.rgb(218, 241, 5))
//@version=6
smaHigh = ta.sma(high, 6)
smaLow = ta.sma(low, 6)
mf=(smaHigh+smaLow)/2
plot(mf, title = 'sma6 ', color = #fd07f500, linewidth = 2)
type_ma = input.string("EMA", "Type", options = ["SMA", "EMA"], group = "MA")
length98 = input.int(3, "Length", inline = "ma", group = "MA")
source98 = input.source(close, "", inline = "ma", group = "MA")
grp98 = "MA Shift Oscillator"
osc_len = input.int(15, "Length", group = grp98, inline = "osc")
osc_threshold = input.float(0.5, "", step = 0.1, group = grp98, inline = "osc")
osc_col_up2 = input.color(color.rgb(255, 255, 255, 100), "", inline = "c", group = "color")
osc_col_dn2 = input.color(color.rgb(0, 0, 0, 100), "", inline = "c", group = "color")
ma(source98, length98, MAtype) =>
switch MAtype
"SMA" => ta.sma(source98, length98)
"EMA" => ta.ema(source98, length98)
// MA
MA = ma(source98, length98, type_ma)
color98 = source98 >= MA ? osc_col_up2 : osc_col_dn2
plot(MA, "ema", color=color98, force_overlay = true, linewidth = 1)
renk = input(true)
grp1 = "Indicator Settings"
src44 = input.source(hlc3, "Source", group=grp1, tooltip="Price source used for band calculations", display = display.data_window)
len44 = input.int(3, "Length", group=grp1, tooltip="Length for the basis calculation", display = display.data_window)
basis = ta.ema(ta.ema(src44, len44), len44)
plot(basis, title = 'ema3', style = plot.style_linebr, color = renk ? basis > close ? color.rgb(0, 0, 0, 100) : color.rgb(255, 255, 255, 100) : color.silver, linewidth = 2)
///////////////////////////////
Yer İmleri