PHP Code:
//@version=6
indicator(title="Parabolic SAR Deviation [BigBeluga]", shorttitle="...", overlay=true, max_lines_count = 500, max_labels_count = 500)
//@version=6
start = input(0.)
increment = input(0.1)
maximum = input(0.9, "Max Value")
//-------------------------------------------------------------------------------------
// SAR calculation for the chart's main timeframe
//-------------------------------------------------------------------------------------
out1 = ta.sar(start, increment, maximum)
plot_color = close > out1 ? color.rgb(5, 182, 64) : close < out1 ? color.rgb(169, 7, 7) : na
//-------------------------------------------------------------------------------------
// Table settings
//-------------------------------------------------------------------------------------
show_header = input(false, title="Show header?", group='Table Settings')
dashboard_position = input.string("Top center", title="Position", options=["Top right", "Bottom right", "Top left", "Bottom left", "Top center", "Bottom 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 = input.string("🔵", title="Uptrend indicator", group='Table Settings')
//downtrend_indicator = input.string("🟠", title="Downtrend indicator", group='Table Settings')
uptrend_indicator = "🔵"
downtrend_indicator = "🟠"
//--------------------------------------------------------------------------------------
// Timeframe settings
// User selects 10 different timeframes
//--------------------------------------------------------------------------------------
tf1 = input.timeframe("1", title="Timeframe 1")
tf2 = input.timeframe("3", title="Timeframe 2")
tf3 = 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")
//--------------------------------------------------------------------------------------
// Table positioning and sizing
//--------------------------------------------------------------------------------------
var table_position = dashboard_position == 'Top center' ? position.top_center :
dashboard_position == 'Top left' ? position.top_left :
dashboard_position == 'Top center' ? position.top_center :
dashboard_position == 'Bottom right' ? position.bottom_right :
dashboard_position == 'Bottom left' ? position.bottom_left :
dashboard_position == 'Bottom center' ? position.bottom_center :
dashboard_position == 'Middle right' ? position.middle_right : position.middle_right
var table_text_size = text_size == 'Normal' ? size.normal :
text_size == 'Large' ? size.large :
text_size == 'Tiny' ? size.tiny :
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) )
//--------------------------------------------------------------------------------------
// Function to determine trend status
//--------------------------------------------------------------------------------------
get_trend_status(trend_value) =>
is_uptrend = close > trend_value
candle_now = is_uptrend ? uptrend_indicator : downtrend_indicator
candle_now
//--------------------------------------------------------------------------------------
// Calculate trend and SAR value for all selected timeframes
//--------------------------------------------------------------------------------------
sar_1 = request.security(syminfo.tickerid, tf1, ta.sar(start, increment, maximum))
sar_2 = request.security(syminfo.tickerid, tf2, ta.sar(start, increment, maximum))
sar_3 = request.security(syminfo.tickerid, tf3, ta.sar(start, increment, maximum))
sar_4 = request.security(syminfo.tickerid, tf4, ta.sar(start, increment, maximum))
sar_5 = request.security(syminfo.tickerid, tf5, ta.sar(start, increment, maximum))
sar_6 = request.security(syminfo.tickerid, tf6, ta.sar(start, increment, maximum))
sar_7 = request.security(syminfo.tickerid, tf7, ta.sar(start, increment, maximum))
sar_8 = request.security(syminfo.tickerid, tf8, ta.sar(start, increment, maximum))
sar_9 = request.security(syminfo.tickerid, tf9, ta.sar(start, increment, maximum))
sar_10 = request.security(syminfo.tickerid, tf10, ta.sar(start, increment, maximum))
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 tf1 == "60"
tf1 := "1H"
if tf1 == "120"
tf1 := "2H"
if tf1 == "180"
tf1 := "3H"
if tf1 == "240"
tf1 := "4H"
if tf2 == "60"
tf2 := "1H"
if tf2 == "120"
tf2 := "2H"
if tf2 == "180"
tf2 := "3H"
if tf2 == "240"
tf2 := "4H"
if tf3 == "60"
tf3 := "1H"
if tf3 == "120"
tf3 := "2H"
if tf3 == "180"
tf3 := "3H"
if tf3 == "240"
tf3 := "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, tf1, 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, tf2, 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, tf3, 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)
//////////////////////////
//@version=6
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
//float start = input.float(0.004, step = 0.001, group = "SAR")
//float increment = input.float(0.004, step = 0.001, group = "SAR")
//int maximum = 1
bool prices = input.bool(true, "Signals", group = "SAR")
color col_up = input.color(#40c3fb, "", inline = "col", group = "SAR")
color col_dn = input.color(#e040fb, "", inline = "col", group = "SAR")
float deviation_size = input.float(3.5, "Deviation", step = 0.1, group = "Deviation Levels")
color color_na = color.new(color.black, 100)
color standart_col = chart.fg_color
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
out = ta.sma(close,50)
deviation_levels(trend)=>
float dist = ta.sma(high-low, 100)*deviation_size
var lines = array.new<line>(1, line(na))
var labels = array.new<label>(1, label(na))
if trend != trend[1]
for i = 1 to 4
y = trend ? close+dist*i : close-dist*i
bool trend = close > out
bool trend_up = ta.crossover(close, out) and barstate.isconfirmed
bool trend_dn = ta.crossunder(close, out) and barstate.isconfirmed
color trend_col = trend ? col_up : col_dn
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
if prices
if trend_up
label.new(bar_index, out, "▲\n" + str.tostring(close, "#,###.####"), style=label.style_label_up, textcolor = trend_col, color = color_na)
if trend_dn
label.new(bar_index, out, str.tostring(close, "#,###.####") + "\n▼", style=label.style_label_down, textcolor = trend_col, color = color_na)
deviation_levels(trend)
// }
/////////////////////
//////////
SAR = ta.sar(0., 0.1, 0.9)
sqzOn = ta.valuewhen(open[0] < SAR, SAR, 0)
sqzOff = ta.valuewhen(open[0] > SAR, SAR, 0)
BE = ta.valuewhen(SAR < sqzOn, SAR + 2 * (sqzOn - SAR), 0)
plot(BE, title = 'BE', linewidth = 2, style = plot.style_cross, color = color.new(color.aqua, 50))
SE = ta.valuewhen(SAR > sqzOff, SAR - 2 * (SAR - sqzOff), 0)
plot(SE, title = 'SE', linewidth = 2, style = plot.style_cross, color = color.new(color.aqua, 50))
/////////////////
s13 = ta.sar(0, 0.1, 0.9)
lookBack13 = input(20)
multi13 = input.float(2, title = 'Multiplier', minval = 0.001, maxval = 2)
mean13 = ta.ema(s13, lookBack13)
stddev = multi13 * ta.stdev(s13, lookBack13)
b123 = mean13 + stddev
s232 = mean13 - stddev
meanp = plot(mean13, title = 'Sar Trend', color = color.new(color.yellow, 0))
bsign = plot(b123, title = 'Sar-Üst Kanal ', color = color.new(color.green, 100), linewidth = 2)
ssign = plot(s232, title = 'Sar-Alt Kanal ', color = color.new(color.red, 100), linewidth = 2)
//////////////////
sadeleştirilecek...kendime not
Yer İmleri