I have a very simple project. I need a specific Trading View Script, Pivot Reversal Strategy (see code below) to be turned into an indicator so that I can add alerts to it on Trading View.
//@version=3
strategy("Pivot Reversal Strategy", overlay=true)
leftBars = input(4)
rightBars = input(2)
swh = pivothigh(leftBars, rightBars)
swl = pivotlow(leftBars, rightBars)
swh_cond = not na(swh)
hprice = 0.0
hprice := swh_cond ? swh : hprice[1]
le = false
le := swh_cond ? true : (le[1] and high > hprice ? false : le[1])
if (le)
[login to view URL]("PivRevLE", [login to view URL], comment="PivRevLE", stop=hprice + [login to view URL])
swl_cond = not na(swl)
lprice = 0.0
lprice := swl_cond ? swl : lprice[1]
se = false
se := swl_cond ? true : (se[1] and low < lprice ? false : se[1])
if (se)
[login to view URL]("PivRevSE", [login to view URL], comment="PivRevSE", stop=lprice - [login to view URL])
//plot([login to view URL], title="equity", color=red, linewidth=2, style=areabr)