Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- 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)
- strategy.entry("PivRevLE", strategy.long, comment="PivRevLE", stop=hprice + syminfo.mintick)
- 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)
- strategy.entry("PivRevSE", strategy.short, comment="PivRevSE", stop=lprice - syminfo.mintick)
- //plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement