-
PHP Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © traderharikrishna
//@version=5
indicator("PSAR-Support Resistance",overlay = true)
mt=input.timeframe('',title='S/R timeframe')
sh=input.int(10,title='Shift S/R Forward/Backward')
start = input.float(title="Start", step=0.01, defval=0.02)
increment = input.float(title="Increment", step=0.01, defval=0.02)
maximum = input.float(title="Maximum", step=0.01, defval=0.2)
sar=request.security(syminfo.tickerid,mt,ta.sar(start,increment,maximum))
plot(sar,style=plot.style_circles,linewidth=1,color=color.yellow)
dir = sar < close ? 1 : -1
buy= dir == 1 and dir[1] == -1
sell=dir == -1 and dir[1] == 1
alertcondition(buy,title='SAR BUY',message='PSAR/Buy Signal')
alertcondition(sell,title='SAR SELL',message='PSAR/Sell Signal')
alertcondition(buy or sell,title='SAR BUY/SELL',message='PSAR/Buy/Sell Signal')
h=ta.valuewhen(buy,close,0)
l=ta.valuewhen(sell,close,0)
buyalert=open>h and close>h and open[1]<h
sellalert=open<l and close<l and open[1]>h
//co=open>h and close>h?color.rgb(6, 217, 240):open<l and close<l?color.rgb(237, 20, 143):color.rgb(242, 231, 8)
//barcolor(color=co)
y=ta.valuewhen(buy,close[0],0)
u=plot(y,color=color.rgb(10, 187, 196),linewidth=1,title='SAR High',offset=sh)
z=ta.valuewhen(sell,close[0],0)
d=plot(z,color=color.rgb(240, 6, 127),linewidth=1,title='SAR Low',offset=sh)
fill(u,d,color=y>z?color.rgb(76, 175, 79, 78):color.rgb(255, 82, 82, 77))
plotshape(buy? sar : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=#06b5e5, textcolor=color.white)
plotshape(sell? sar : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.rgb(249, 11, 106), textcolor=color.white)
malen=input.int(5,title='Moving Average Length')
matype=input.string('ema',title='Moving Average',options=['hma','ema','wma','sma'])
ma1=matype=='wma'?ta.wma(close,malen):matype=='ema'?ta.ema(close,malen):matype=='hma'?ta.hma(close,malen):matype=='sma'?ta.sma(close,malen):ta.ema(close,malen)
plot(ma1,linewidth=2,color=#06ebf3e3,title='Moving Average')
malen2=input.int(22,title='Moving Average Length')
matype2=input.string('ema',title='Moving Average',options=['hma','ema','wma','sma'])
ma2=matype2=='wma'?ta.wma(close,malen2):matype2=='ema'?ta.ema(close,malen2):matype2=='hma'?ta.hma(close,malen2):matype2=='sma'?ta.sma(close,malen2):ta.ema(close,malen2)
plot(ma2,linewidth=2,color=#f10b3df1,title='Moving Average2')
[macd,signal,hist]=ta.macd (close,12,26,9)
buycx=hist>0 and ta.crossover (ma1,ma2)
sellcx=hist <0 and ta.crossunder(ma1,ma2)
plotshape (buycx,title='MA-Buy',location=location.belowbar,style=shape.triangleup, color=#03800acc,size=size.tiny)
plotshape (sellcx,title='MA-Sell', location = location.abovebar, style =shape.triangledown, color= #ff0404,size=size.tiny)
-
-
-
-
PHP Code:
// © KLYTON
//@version=5
indicator("Pivot Points BB and SS + Alerts",overlay=true,max_labels_count=500,max_lines_count=500,max_bars_back=500)
length = input(27,'Pivot Length')
show_reg = input.bool(true,'Regular Pivots',inline='inline1')
reg_ph_css = input.color(#ef5350,'High',inline='inline1')
reg_pl_css = input.color(#26a69a,'Low',inline='inline1')
show_miss = input.bool(true,'Missed Pivots',inline='inline2')
miss_ph_css = input.color(#ef5350,'High',inline='inline2')
miss_pl_css = input.color(#26a69a,'Low',inline='inline2')
allow_alerts = input.bool(true, "Allow alerts")
label_css = input.color(color.white,'Text Label Color')
//------------------------------------------------------------------------------
var line zigzag = na
var line ghost_level = na
var max = 0.,var min = 0.
var max_x1 = 0,var min_x1 = 0
var follow_max = 0.,var follow_max_x1 = 0
var follow_min = 0.,var follow_min_x1 = 0
var os = 0,var py1 = 0.,var px1 = 0
//------------------------------------------------------------------------------
n = bar_index
ph = ta.pivothigh(length,length)
pl = ta.pivotlow(length,length)
max := math.max(high[length],max)
min := math.min(low[length],min)
follow_max := math.max(high[length],follow_max)
follow_min := math.min(low[length],follow_min)
if max > max[1]
max_x1 := n-length
follow_min := low[length]
if min < min[1]
min_x1 := n-length
follow_max := high[length]
if follow_min < follow_min[1]
follow_min_x1 := n-length
if follow_max > follow_max[1]
follow_max_x1 := n-length
//------------------------------------------------------------------------------
line.set_x2(ghost_level[1],n)
// Alert conditions
var alert_triggered_reg_high = false
var alert_triggered_reg_low = false
var alert_triggered_missed_low = false
var alert_triggered_missed_high = false
var current_signal = "none"
if ph
if show_miss
if os[1] == 1
label.new(min_x1,min,'Buy',textcolor=label_css,color=miss_pl_css,style=label.style_label_up,size=size.normal,
tooltip=str.tostring(min,'#.####'))
zigzag := line.new(px1,py1,min_x1,min,color=miss_ph_css,style=line.style_dashed)
px1 := min_x1,py1 := min
line.set_x2(ghost_level[1],px1)
ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_pl_css,50),width=2)
// Set the alert condition for missed pivot
alert_triggered_missed_low := true
if current_signal == "Sell" and allow_alerts
alert("Buy")
current_signal := "Buy"
else if ph < max
label.new(max_x1,max,'Buy',textcolor=label_css,color=miss_ph_css,style=label.style_label_down,size=size.normal,
tooltip=str.tostring(max,'#.####'))
label.new(follow_min_x1,follow_min,'Buy',textcolor=label_css,color=miss_pl_css,style=label.style_label_up,size=size.normal,
tooltip=str.tostring(min,'#.####'))
zigzag := line.new(px1,py1,max_x1,max,color=miss_pl_css,style=line.style_dashed)
px1 := max_x1,py1 := max
line.set_x2(ghost_level[1],px1)
ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_ph_css,50),width=2)
zigzag := line.new(px1,py1,follow_min_x1,follow_min,color=miss_ph_css,style=line.style_dashed)
px1 := follow_min_x1,py1 := follow_min
line.set_x2(ghost_level,px1)
ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_pl_css,50),width=2)
// Set the alert condition for regular pivot low
alert_triggered_reg_high := true
if current_signal == "Sell" and allow_alerts
alert("Buy")
current_signal := "Buy"
if show_reg
label.new(n-length,ph,'Sell',textcolor=label_css,color=reg_ph_css,style=label.style_label_down,size=size.normal,
tooltip=str.tostring(ph,'#.####'))
zigzag := line.new(px1,py1,n-length,ph,color=miss_pl_css,style=ph < max or os[1] == 1 ? line.style_dashed : line.style_solid)
// Set the alert condition for regular pivot high
alert_triggered_reg_high := true
if current_signal == "Buy" and allow_alerts
alert("Sell")
current_signal := "Sell"
py1 := ph,px1 := n-length,os := 1,max := ph,min := ph
//------------------------------------------------------------------------------
if pl
if show_miss
if os[1] == 0
label.new(max_x1,max,'Sell',textcolor=label_css,color=miss_ph_css,style=label.style_label_down,size=size.normal,
tooltip=str.tostring(max,'#.####'))
zigzag := line.new(px1,py1,max_x1,max,color=miss_pl_css,style=line.style_dashed)
px1 := max_x1,py1 := max
line.set_x2(ghost_level[1],px1)
ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_ph_css,50),width=2)
// Set the alert condition for missed pivot
alert_triggered_missed_low := true
if current_signal == "Buy" and allow_alerts
alert("Sell")
current_signal := "Sell"
else if pl > min
label.new(follow_max_x1,follow_max,'Sell',textcolor=label_css,color=miss_ph_css,style=label.style_label_down,size=size.normal,
tooltip=str.tostring(max,'#.####'))
label.new(min_x1,min,'Sell',textcolor=label_css,color=miss_pl_css,style=label.style_label_up,size=size.normal,
tooltip=str.tostring(min,'#.####'))
zigzag := line.new(px1,py1,min_x1,min,color=miss_ph_css,style=line.style_dashed)
px1 := min_x1,py1 := min
line.set_x2(ghost_level[1],px1)
ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_pl_css,50),width=2)
zigzag := line.new(px1,py1,follow_max_x1,follow_max,color=miss_pl_css,style=line.style_dashed)
px1 := follow_max_x1,py1 := follow_max
line.set_x2(ghost_level,px1)
ghost_level := line.new(px1,py1,px1,py1,color=color.new(reg_ph_css,50),width=2)
// Set the alert condition for regular pivot low
alert_triggered_reg_low := true
if current_signal == "Buy" and allow_alerts
alert("Sell")
current_signal := "Sell"
if show_reg
label.new(n-length,pl,'Buy',textcolor=label_css,color=reg_pl_css,style=label.style_label_up,size=size.normal,
tooltip=str.tostring(pl,'#.####'))
zigzag := line.new(px1,py1,n-length,pl,color=miss_ph_css,style=pl > min or os[1] == 0 ? line.style_dashed : line.style_solid)
// Set the alert condition for regular pivot high
alert_triggered_reg_high := true
if current_signal == "Sell" and allow_alerts
alert("Buy")
current_signal := "Buy"
py1 := pl,px1 := n-length,os := 0,max := pl,min := pl
//------------------------------------------------------------------------------
var label lbl = na
if barstate.islast
x = 0,y = 0.
prices = array.new_float(0)
prices_x = array.new_int(0)
for i = 0 to n-px1-1
array.push(prices,os==1?low[i]:high[i])
array.push(prices_x,n-i)
label.delete(lbl[1])
if os == 1
y := array.min(prices)
x := array.get(prices_x,array.indexof(prices,y))
if show_miss
lbl := label.new(x,y,'Buy',textcolor=label_css,color=miss_pl_css,style=label.style_label_up,size=size.normal,
tooltip=str.tostring(y,'#.####'))
else
y := array.max(prices)
x := array.get(prices_x,array.indexof(prices,y))
if show_miss
lbl := label.new(x,y,'Sell',textcolor=label_css,color=miss_ph_css,style=label.style_label_down,size=size.normal,
tooltip=str.tostring(y,'#.####'))
if show_miss
line.delete(line.new(px1,py1,x,y,color=os == 1 ? miss_ph_css : miss_pl_css,style=line.style_dashed)[1])
line.delete(line.new(x,y,n,y,color = color.new(os == 1 ? miss_ph_css : miss_pl_css,50),width=2)[1])
// Alert conditions
alertcondition(alert_triggered_reg_high, title="Regular Pivot High", message="Regular pivot high alert triggered!")
alertcondition(alert_triggered_reg_low, title="Regular Pivot Low", message="Regular pivot low alert triggered!")
alertcondition(alert_triggered_missed_high, title="Missed High Pivot", message="Missed pivot alert triggered!")
alertcondition(alert_triggered_missed_low, title="Missed Low Pivot", message="Missed pivot alert triggered!")
// created by senthil
//@version=5
//
//toggleBreaks = input(true, title='Show Breaks')
//leftBars = input(5, title='Left Bars ')
//rightBars = input(5, title='Right Bars')
//volumeThresh = input(20, title='Volume Threshold')
//
//highUsePivot = fixnan(ta.pivothigh(leftBars, rightBars)[1])
//lowUsePivot = fixnan(ta.pivotlow(leftBars, rightBars)[1])
//r1 = plot(highUsePivot, color=ta.change(highUsePivot) ? na : #FF0000, linewidth=3, offset=-(rightBars + 1), title='Resistance')
//s1 = plot(lowUsePivot, color=ta.change(lowUsePivot) ? na : #233dee, linewidth=3, offset=-(rightBars + 1), title='Support')
//Volume %
//short = ta.ema(volume, 5)
//long = ta.ema(volume, 10)
//osc = 100 * (short - long) / long
//For breaks with volume
//plotshape(toggleBreaks and ta.crossunder(close, lowUsePivot) and not(open - close < high - open) and osc > volumeThresh, title='Break', text='B', style=shape.labeldown, location=location.abovebar, color=color.rgb(255, 82, 82), textcolor=color.new(color.white, 0), size=size.tiny)
//plotshape(toggleBreaks and ta.crossover(close, highUsePivot) and not(open - low > close - open) and osc > volumeThresh, title='Break', text='B', style=shape.labelup, location=location.belowbar, color=color.rgb(56, 198, 34), textcolor=color.new(color.white, 0), size=size.tiny)
//For bull / bear wicks
//plotshape(toggleBreaks and ta.crossover(close, highUsePivot) and open - low > close - open, title='Break', text='Bull Wick', style=shape.labelup, location=location.belowbar, color=color.rgb(56, 198, 34), textcolor=color.new(color.white, 0), size=size.tiny)
//plotshape(toggleBreaks and ta.crossunder(close, lowUsePivot) and open - close < high - open, title='Break', text='Bear Wick', style=shape.labeldown, location=location.abovebar, color=color.rgb(255, 82, 82), textcolor=color.new(color.white, 0), size=size.tiny)
//alertcondition(ta.crossunder(close, lowUsePivot) and osc > volumeThresh, title='Support Broken', message='Support Broken')
//alertcondition(ta.crossover(close, highUsePivot) and osc > volumeThresh, title='Resistance Broken', message='Resistance Broken')
src = input.source(title='Source', defval=close, group='CTI')
sm = input.int(27, title='Smoothing Period', group='CTI')
cd = input.float(1.4, title='Constant D', group='CTI')
bar_col = input.bool(false, title='Color Bars', inline='br', group='Color mode')
flat = input.color(title='Line', defval=color.new(color.blue, 0), inline='br', group='Color mode')
raise = input.color(title='Color', defval=color.new(color.green, 0), inline='col', group='Style')
fall = input.color(title='Color', defval=color.new(color.red, 0), inline='col', group='Style')
di = (sm - 1.0) / 2.0 + 1.0
c1 = 2 / (di + 1.0)
c2 = 1 - c1
c3 = 3.0 * (cd * cd + cd * cd * cd)
c4 = -3.0 * (2.0 * cd * cd + cd + cd * cd * cd)
c5 = 3.0 * cd + 1.0 + cd * cd * cd + 3.0 * cd * cd
var float i1 = na
var float i2 = na
var float i3 = na
var float i4 = na
var float i5 = na
var float i6 = na
i1 := c1 * src + c2 * nz(i1[1])
i2 := c1 * i1 + c2 * nz(i2[1])
i3 := c1 * i2 + c2 * nz(i3[1])
i4 := c1 * i3 + c2 * nz(i4[1])
i5 := c1 * i4 + c2 * nz(i5[1])
i6 := c1 * i5 + c2 * nz(i6[1])
Cto = -cd * cd * cd * i6 + c3 * i5 + c4 * i4 + c5 * i3
// --------------------------------------------------------------------------
// For the Pinescript coders: Determining trend based on the mintick step.
// --------------------------------------------------------------------------
//bfrC = Cto - nz(Cto[1]) > syminfo.mintick ? green : Cto - nz(Cto[1]) < syminfo.mintick ? red : blue
bfrC = Cto > nz(Cto[1]) ? raise : Cto < nz(Cto[1]) ? fall : na
tc = bar_col ? flat : bfrC
plot(Cto, title='Trend', linewidth=3, style=plot.style_stepline, color=tc, editable=false)
barcolor(bar_col ? bfrC : na, editable=false)
shift_up = bfrC[1] == fall and bfrC == raise
shift_dn = bfrC[1] == raise and bfrC == fall
plotshape(shift_up, title='Buy', text='.', textcolor=raise, style=shape.triangleup, location=location.belowbar, color=color.new(#2dac32, 0))
plotshape(shift_dn, title='Sell', text='.', textcolor=fall, style=shape.triangledown, location=location.abovebar, color=color.new(color.orange, 0))
//alertcondition(shift_up, title='Alert for Buy', message='Buy')
//alertcondition(shift_dn, title='Alert for Sell', message='Sell')
-
Sayın yörük çok teşekkür ederim, görmediniz sanmıştım. Error cannot compile script ifadesi var.
Fiyat üzerinde değil, ayrı pencerede görünsün istiyorum. Bir de al sat sinyalleri görünmese daha iyi olur..
-
fiyattan hesapladığı ayrı pencere olmaz....
sinyalleri stil kısmından kapatabilirsiniz...
-
PHP Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © carefulCode53358
study("n")
//@version=2
renk = input(true, title="Adaptive Coloring", type=bool)
a = sar(0.1,0.01,0.1)
b = sar(0.1,0.02,0.2)
c = sar(0.1,0.03,0.3)
plot(a, title="a", style=circles, color=renk?(a>close?red:lime) : silver, transp=00, linewidth=1)
plot(b, title="b", style=circles, color=renk?(b>close?red:lime) : silver, transp=00, linewidth=1)
plot(c, title="c", style=circles, color=renk?(c>close?red:lime) : silver, transp=00, linewidth=1)
aa = sar(0.01,0.01,0.1)
bb = sar(0.01,0.02,0.2)
cc = sar(0.01,0.03,0.3)
plot(aa, title="aa", style=circles, color=renk?(aa>close?red:lime) : silver, transp=00, linewidth=1)
plot(bb, title="bb", style=circles, color=renk?(bb>close?red:lime) : silver, transp=00, linewidth=1)
plot(cc, title="cc", style=circles, color=renk?(cc>close?red:lime) : silver, transp=00, linewidth=1)
aaa = sar(0,0.01,0.1)
bbb = sar(0,0.02,0.2)
ccc = sar(0,0.03,0.3)
plot(aaa, title="aaa", style=circles, color=renk?(aaa>close?red:lime) : silver, transp=00, linewidth=1)
plot(bbb, title="bbb", style=circles, color=renk?(bbb>close?red:lime) : silver, transp=00, linewidth=1)
plot(ccc, title="ccc", style=circles, color=renk?(ccc>close?red:lime) : silver, transp=00, linewidth=1)
xa=(a+aa+aaa)/3
xb=(b+bb+bbb)/3
xc=(c+cc+ccc)/3
plot(xa, title="xa", style=circles, color=renk?(xa>close?red:lime) : silver, transp=00, linewidth=1)
plot(xb, title="xb", style=circles, color=renk?(xb>close?red:lime) : silver, transp=00, linewidth=1)
plot(xc, title="xc", style=circles, color=renk?(xc>close?red:lime) : silver, transp=00, linewidth=1)
xaa=(a+b+c)/3
xbb=(aa+bb+cc)/3
xcc=(aaa+bbb+ccc)/3
plot(xaa, title="xaa", style=circles, color=renk?(xaa>close?red:lime) : silver, transp=00, linewidth=1)
plot(xbb, title="xbb", style=circles, color=renk?(xbb>close?red:lime) : silver, transp=00, linewidth=1)
plot(xcc, title="xcc", style=circles, color=renk?(xcc>close?red:lime) : silver, transp=00, linewidth=1)
///////////////////////////////////////////////////////////////////////////////////////