BIST:PSDTC   PERGAMON DIS TICARET
//@version=3
//Cryptocurrency Trading Tools by XMAXPRO
//PÝVOT DÖNÜÞLERÝ INDIKATORU
//Test 1.0v Tarih:04.08.2019

study("Pivot Returns", overlay=true, shorttitle="PivotR")
leftBars = input(4)
rightBars = input(4)

// Hesaplama
swh = pivothigh(leftBars, rightBars)
swl = pivotlow(leftBars, rightBars)
swh_cond = not na(swh)
hprice = 0.0
hprice := swh_cond ? swh : hprice
swl_cond = not na(swl)
lprice = 0.0
lprice := swl_cond ? swl : lprice

// Tetikler
long = crossover(high, hprice + syminfo.mintick)
short = crossunder(low, lprice - syminfo.mintick)
last_signal = 0
long_final = long and (nz(last_signal) == 0 or nz(last_signal) == -1)
short_final = short and (nz(last_signal) == 0 or nz(last_signal) == 1)
last_signal := long_final ? 1 : short_final ? -1 : last_signal

plotshape(long_final, style = shape.arrowup, color = green, location = location.abovebar, text = "Long")
plotshape(short_final, style = shape.arrowdown, color = red, location = location.belowbar, text = "Short")

plot(lprice, color = red)
plot(hprice, color = green)

// Alarmlar
alertcondition(long_final, "Pivot Long", "Pivot Long")
alertcondition(short_final, "Pivot Short", "Pivot Short")

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.