PHP Code:
// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
// https://creativecommons.org/licenses/by-nc-sa/4.0/
// © BigBeluga
//@version=6
indicator(title="Parabolic SAR Deviation [BigBeluga]", shorttitle="...", overlay=true, max_lines_count = 500, max_labels_count = 500)
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
float start = input.float(0., step = 0.01, group = "SAR")
float increment = input.float(0.01, step = 0.001, group = "SAR")
int maximum = 1
bool prices = input.bool(true, "Signals", group = "SAR")
color col_up = input.color(color.rgb(202, 245, 8), "", inline = "col", group = "SAR")
color col_dn = input.color(color.rgb(10, 219, 242), "", inline = "col", group = "SAR")
float deviation_size = input.float(1.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.sar(start, increment, maximum)
deviation_levels(trend)=>
float dist = ta.sma(high-low, 100)*deviation_size
var lines = array.new<line>(4, line(na))
var labels = array.new<label>(4, label(na))
if trend != trend[1]
for i = 1 to 4
y = trend ? close+dist*i : close-dist*i
line1 = line.new(bar_index, y, bar_index, y, color = standart_col)
label1 = label.new(bar_index, y, str.tostring(i), style = label.style_label_right, color = color_na, textcolor = standart_col)
labels.push(label1)
lines.push(line1)
if lines.size() > 4
line.delete(lines.shift())
label.delete(labels.shift())
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)
//pp = plot(hl2, editable = false, display = display.none)
po = plot(trend != trend[1] ? na : out, "SAR", color=trend_col, style = plot.style_linebr, linewidth = 2)
//fill(pp, po, hl2, out, na, color.new(trend_col, 90))
// }
/////////////////////
// This indicator is created under TechnoBlooms - Innovating Trading Indicators and Strategies.
// All rights reserved. Unauthorized copying or distribution is prohibited.
// © TechnoBlooms
//@version=6
//-------------------------------------------------------------------------------------
// Inputs for SAR
//-------------------------------------------------------------------------------------
start1 = input(0.)
increment1 = input(0.01)
maximum1 = input(0.2, "Max Value")
//-------------------------------------------------------------------------------------
// SAR calculation for the chart's main timeframe
//-------------------------------------------------------------------------------------
out1 = ta.sar(start1, increment1, maximum1)
plot_color = close > out1 ? color.rgb(5, 182, 64) : close < out ? color.rgb(169, 7, 7) : na
//-------------------------------------------------------------------------------------
// Table settings
//-------------------------------------------------------------------------------------
show_header = input(false, title="Show header?", group='Table Settings')
dashboard_position = input.string("Middle right", 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 right' ? position.top_right :
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.rgb(224, 64, 251):#64d9e8,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.rgb(224, 64, 251):#64d9e8,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.rgb(224, 64, 251):#64d9e8,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.rgb(224, 64, 251):#64d9e8,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.rgb(224, 64, 251):#64d9e8,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.rgb(224, 64, 251):#64d9e8,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.rgb(224, 64, 251):#64d9e8,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.rgb(224, 64, 251):#64d9e8,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.rgb(224, 64, 251):#64d9e8,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.rgb(224, 64, 251):#64d9e8,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,"T.F",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,"PRICE",text_color = color.white,bgcolor = color.rgb(21, 21, 21))
//------------------------------------------------------------------------------------------
// Determine how far back the line should extend
//------------------------------------------------------------------------------------------
lookback = input.int(5, "Line Lookback Period", minval=1)
//------------------------------------------------------------------------------------------
// On each new bar, create or update the line
///////////////////////////
//@version=6
// INPUTS //
//
start3 = input(0.0)
increment3 = input(0.01)
maximum3 = input(0.2)
s1 = ta.sar(start3, increment3, maximum3)
//pc = close < s1 ? color.red : color.green
//plot(s1, style = plot.style_cross, color = pc)
//
lookBack = input(40)
//
multi = input.float(2, title = 'Multiplier', minval = 0.001, maxval = 2)
mean = ta.ema(s1, lookBack)
stddev = multi * ta.stdev(s1, lookBack)
b = mean + stddev
s2 = mean - stddev
meanp = plot(mean, title = 'Mean', color = color.new(color.yellow, 0))
bsign = plot(b, title = 'Upper ', color = color.new(color.green, 0), linewidth = 2)
ssign = plot(s2, title = 'Lower ', color = color.new(color.red, 0), linewidth = 2)
//////////////////////////
örnek kod.....dilediğiniz değişiklikleri yapabilmeniz için.....
Yer İmleri