PHP Code:
//@version=5
indicator(".",overlay=true, max_bars_back=500,max_lines_count = 500)
offset=5
_high=high[offset]
_low=low[offset]
_open=open[offset]
_close=close[offset]
_body=_close-_open
_range=_high-_low
_u_shadow=_high-math.max(_open,_close)
_d_shadow=math.min(_open,_close)-_low
_type=_close>_high[5] and math.abs(_body)>_u_shadow+_d_shadow?1:_close<_low[5] and math.abs(_body)>_u_shadow+_d_shadow?-1:0
var eq=0.0, var pe=0.0, var ote=0.0, var me=0.0, old_high=0.0, old_low=0.0
if _type==-1
old_high:=_high
old_low:=_low
eq:=math.avg(_high,_low)
pe:=_low+0.618*_range
ote:=_low+0.705*_range
me:=_low+0.79*_range
if _type==1
old_high:=_high
old_low:=_low
eq:=math.avg(_high,_low)
pe:=_high-0.618*_range
ote:=_high-0.705*_range
me:=_high-0.79*_range
if _type==0
old_high:=old_high[5]
old_low:=old_low[5]
eq:=eq[5]
pe:=pe[5]
ote:=ote[5]
me:=me[5]
//Parameter
_col_lv=ta.valuewhen(_type!=0,_type,0)==1?color.new(color.green,00):ta.valuewhen(_type!=0,_type,0)==-1?color.new(color.red,00):na
plot(
math.round_to_mintick(eq),
title="0.5",
style=plot.style_line,
color=_col_lv,
offset=0
)
plot(
math.round_to_mintick(pe),
title="0.61",
style=plot.style_line,
color=_col_lv,
offset=0
)
plot(
math.round_to_mintick(ote),
title="0.70",
style=plot.style_line,
color=_col_lv,
offset=0
)
plot(
math.round_to_mintick(me),
title="0.79",
style=plot.style_line,
color=_col_lv,
offset=0
)
a1 = (close[0] + low[9] + high[9]) / 3
plot(a1, color=color.rgb(255, 255, 255, 100), title='9Bar', linewidth=1)
a2 = (close[0] + low[5] + high[5]) / 3
plot(a2, color=color.rgb(255, 255, 255, 100), title='5Bar', linewidth=1)
a3 = (close[0] + low[3] + high[3]) / 3
plot(a3, color=color.rgb(255, 255, 255, 100), title='3Bar', linewidth=1)
///
a = (close[60] + low[60] + high[60]) / 3
b = (close[20] + low[20] + high[20]) / 3
c = (close[12] + low[12] + high[12]) / 3
d = (close[4] + low[4] + high[4]) / 3
e = (close[2] + low[2] + high[2]) / 3
f = (close[1] + low[1] + high[1]) / 3
g = (close[0] + low[0] + high[0]) / 3
avg=(a+b+c+d+e+f)/6
plot(avg, color=color.rgb(223, 64, 251, 100), title='Denge', linewidth=2)
///
//@version=5
//Basic
length = input.int(5, group='Basic Settings', tooltip='Pivot length. Use higher values for having lines connected to more significant pivots')
lookback = input.int(1, minval=1, group='Basic Settings', tooltip='Number of lines connecting a pivot high/low to display')
Slope = input.float(0.7, minval=-1, maxval=1, step=0.1, group='Basic Settings', tooltip='Allows to multiply the linear regression slope by a number within -1 and 1')
//Style
ph_col = input.color(#2157f3, 'Pivot High Lines Color', group='Line Colors')
pl_col = input.color(#ff1100, 'Pivot Low Lines Color', group='Line Colors')
//──────────────────────────────────────────────────────────────────────────────
Sma(src, p) =>
a = ta.cum(src)
(a - a[math.max(p, 0)]) / math.max(p, 0)
Variance(src, p) =>
p == 1 ? 0 : Sma(src * src, p) - math.pow(Sma(src, p), 2)
Covariance(x, y, p) =>
Sma(x * y, p) - Sma(x, p) * Sma(y, p)
//──────────────────────────────────────────────────────────────────────────────
n = bar_index
ph = ta.pivothigh(length, length)
pl = ta.pivotlow(length, length)
//──────────────────────────────────────────────────────────────────────────────
varip ph_array = array.new_float(0)
varip pl_array = array.new_float(0)
varip ph_n_array = array.new_int(0)
varip pl_n_array = array.new_int(0)
if ph
array.insert(ph_array, 0, ph)
array.insert(ph_n_array, 0, n)
if pl
array.insert(pl_array, 0, pl)
array.insert(pl_n_array, 0, n)
//──────────────────────────────────────────────────────────────────────────────
val_ph = ta.valuewhen(ph, n - length, lookback - 1)
val_pl = ta.valuewhen(pl, n - length, lookback - 1)
val = math.min(val_ph, val_pl)
k = n - val > 0 ? n - val : 2
slope = Covariance(close, n, k) / Variance(n, k) * Slope
var line ph_l = na
var line pl_l = na
if barstate.islast
for i = 0 to lookback - 1 by 1
ph_y2 = array.get(ph_array, i)
ph_x1 = array.get(ph_n_array, i) - length
pl_y2 = array.get(pl_array, i)
pl_x1 = array.get(pl_n_array, i) - length
ph_l := line.new(ph_x1, ph_y2, ph_x1 + 1, ph_y2 + slope, extend=extend.right, color=ph_col)
pl_l := line.new(pl_x1, pl_y2, pl_x1 + 1, pl_y2 + slope, extend=extend.right, color=pl_col)
pl_l
///
src55 = input(close, title="Source")
highlight = input(true, title="Highlighting?")
showSignals = input(true, title="Show Signals?")
Q1 = input.int(3, title="Q1")
Q2 = input.float(0.8, title="Q2")
Q3 = Q2/100
Q4 = ta.wma(src55, Q1)
Q5 = 0.0
Q5 := (Q4*(1-Q3))>nz(Q5[1],0) ? Q4*(1-Q3) : (Q4*(1+Q3))<nz(Q5[1],0) ? Q4*(1+Q3) : nz(Q5[1],0)
Z1 = input.int(3, title="Z1")
Z2 = input.float(1.23, title="Z2")
Z3 = Z2/100
Z4 = ta.wma(src55, Z1)
Z5 = 0.0
Z5 := (Z4*(1-Z3))>nz(Z5[1],0) ? Z4*(1-Z3) : (Z4*(1+Z3))<nz(Z5[1],0) ? Z4*(1+Z3) : nz(Z5[1],0)
//BuySignal = ta.crossover(Q5,Z5)
//SellSignal = ta.crossunder(Q5,Z5)
//Q5pl=plot(int(Q5/0.025+0.50)*0.025, color=color.rgb(76, 175, 79, 100), linewidth=1)
//=plot(int(Z5/0.025+0.50)*0.025, color=color.rgb(255, 82, 82, 100), linewidth=1)
//fill(Q5pl,Z5pl, color= highlight ? Q5>Z5 ? color.new(color.green,50) : color.new(color.red,50) : na)
//plotshape(showSignals and BuySignal, title="Buy Signal", style=shape.labelup, text="Al", textcolor=color.white, color=color.green, location=location.belowbar)
//plotshape(showSignals and SellSignal, title="Sell Signal", style=shape.labeldown, text="SAT", textcolor=color.white, color=color.red, location=location.abovebar)
farkx=close-(Q5-close[1])
fiyat=plot(farkx,title = "Babayaga", color=color.orange, linewidth=1)
//BuySignalx = ta.crossover(farkx,Q5[0])
//SellSignalx = ta.crossunder(farkx,Q5[0])
//Q5plx=plot(int(Q5/1.025+0.50)*1.025, color=color.green, linewidth=1)
//Z5plx=plot(int(Z5/1.025+0.50)*1.025, color=color.red, linewidth=1)
//fill(Q5plx,Z5plx, color= highlight ? Q5>Z5 ? color.new(color.yellow,50) : color.new(color.aqua,50) : na)
//plotshape(showSignals and BuySignalx, title="Buy Signal", style=shape.labelup, text="Al", textcolor=color.black, color=color.aqua, location=location.bottom)
//plotshape(showSignals and SellSignalx, title="Sell Signal", style=shape.labeldown, text="SAT", textcolor=color.black, color=color.yellow, location=location.top)
////
// Pivot point bias drop down selection for bulish, bearish, and Out Of Position highlights.
biasInput = input.string(title='Pivot Point Bias', defval='All', options=['Bullish', 'Bearish', 'Out of Position', 'Range', 'All'])
// Automaticly selects a daily, weekly, or monthly pivot point based on the timeframe being used.
defaultTimeFrame = timeframe.period == '1' ? 'D' : timeframe.period == '5' ? 'D' : timeframe.period == '15' ? 'D' : timeframe.period == '30' ? 'D' : timeframe.period == '60' ? 'D' : timeframe.period == '240' ? 'W' : timeframe.period == 'D' ? 'M' : timeframe.isweekly ? '12M' : timeframe.ismonthly ? '12M' : '120M'
inputTimeFrame = input.timeframe(title='Time Frame', defval='')
pResolution = inputTimeFrame == '' ? defaultTimeFrame : inputTimeFrame
f_avgDilationOf(pResolution) =>
b = ta.barssince(ta.change(time(pResolution)))
cumTotal = ta.cum(b == 0 ? b[1] + 1 : 0)
cumCount = ta.cum(b == 0 ? 1 : 0)
cumTotal / cumCount
avg_resOffset = pResolution == 'D' ? math.ceil(f_avgDilationOf(pResolution)) + 0 : math.ceil(f_avgDilationOf(pResolution))
// Hide or display pivot point labels, such as S1, M2, P, M3, R1, etc.
bShowLabels = input(title='Show All Pivot Labels', defval=true)
bPlotEditable = true
c_orange1 = color.new(#ffee00, 0)
plotColorP = input(c_orange1, 'Central Pivot')
prevCloseHTF = request.security(syminfo.tickerid, pResolution, close[0], lookahead=barmerge.lookahead_on)
prevOpenHTF = request.security(syminfo.tickerid, pResolution, open[0], lookahead=barmerge.lookahead_on)
prevHighHTF = request.security(syminfo.tickerid, pResolution, high[0], lookahead=barmerge.lookahead_on)
prevLowHTF = request.security(syminfo.tickerid, pResolution, low[0], lookahead=barmerge.lookahead_on)
pLevel = (prevHighHTF + prevLowHTF + prevCloseHTF) / 3
var bool allBias = false
if biasInput == 'All'
allBias := true
allBias
pPlot = plot(allBias ? pLevel : na, title='Babayaga', offset=int(avg_resOffset), color=ta.change(pLevel) != 0 ? na : plotColorP, editable=bPlotEditable)
///
Yer İmleri