Advertisement
JustUncleL

Reverse RSI Strategy Long

Jan 29th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. //@version=2
  2. strategy("Reverse RSI Strategy Long Only", overlay=true)
  3. length = input( 11 )
  4. overSold = input( 30 )
  5. overBought = input( 70 )
  6. price = close
  7.  
  8. vrsi = rsi(price, length)
  9.  
  10. // Check for 1st Bar exit the PAC, use Heikin Ashi Bars
  11. xLong = crossover(vrsi, overBought) ? 1 : crossunder(vrsi, overSold)? 0 : nz(xLong[1])
  12. xShort = crossover(vrsi, overBought) ? 0 : crossunder(vrsi, overSold)? 1 : nz(xShort[1])
  13.  
  14. Long = xLong ? na(Long[1]) ? 1 : Long[1]+1 : 0
  15. Short = xShort ? na(Short[1]) ? 1 : Short[1]+1 : 0
  16.  
  17.  
  18. if (not na(vrsi))
  19. if (Short==1)
  20. strategy.close("LONGSE")
  21. if (Long==1)
  22. strategy.entry("LONGSE", strategy.long, comment="LONGSE")
  23.  
  24. //plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement