Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. //@version=4
  2. strategy("Pivot Reversal Strategy", overlay=true)
  3.  
  4. leftBars = input(4)
  5. rightBars = input(2)
  6.  
  7. swh = pivothigh(leftBars, rightBars)
  8. swl = pivotlow(leftBars, rightBars)
  9.  
  10. swh_cond = not na(swh)
  11.  
  12. hprice = 0.0
  13. hprice := swh_cond ? swh : hprice[1]
  14.  
  15. le = false
  16. le := swh_cond ? true : (le[1] and high > hprice ? false : le[1])
  17.  
  18. if (le)
  19. strategy.entry("PivRevLE", strategy.long, comment="PivRevLE", stop=hprice + syminfo.mintick)
  20.  
  21. swl_cond = not na(swl)
  22.  
  23. lprice = 0.0
  24. lprice := swl_cond ? swl : lprice[1]
  25.  
  26.  
  27. se = false
  28. se := swl_cond ? true : (se[1] and low < lprice ? false : se[1])
  29.  
  30. if (se)
  31. strategy.entry("PivRevSE", strategy.short, comment="PivRevSE", stop=lprice - syminfo.mintick)
  32.  
  33. //plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement