Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=2
- strategy("Reverse RSI Strategy Long Only", overlay=true)
- length = input( 11 )
- overSold = input( 30 )
- overBought = input( 70 )
- price = close
- vrsi = rsi(price, length)
- // Check for 1st Bar exit the PAC, use Heikin Ashi Bars
- xLong = crossover(vrsi, overBought) ? 1 : crossunder(vrsi, overSold)? 0 : nz(xLong[1])
- xShort = crossover(vrsi, overBought) ? 0 : crossunder(vrsi, overSold)? 1 : nz(xShort[1])
- Long = xLong ? na(Long[1]) ? 1 : Long[1]+1 : 0
- Short = xShort ? na(Short[1]) ? 1 : Short[1]+1 : 0
- if (not na(vrsi))
- if (Short==1)
- strategy.close("LONGSE")
- if (Long==1)
- strategy.entry("LONGSE", strategy.long, comment="LONGSE")
- //plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement