Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //@version=3
  2. strategy(title = "BackTestBug", overlay = false, pyramiding = 0, initial_capital=10000, currency=currency.USD, default_qty_type=strategy.fixed, default_qty_value=100000, calc_on_every_tick=false, max_bars_back=5000)
  3.  
  4. GoLong=crossover(rsi(close,14),30)
  5. GoShort=crossunder(rsi(close,14),70)
  6. KillShort=cross(rsi(close,14),50)
  7. KillLong=cross(rsi(close,14),50)
  8.  
  9. strategy.entry("long", strategy.long, when=GoLong)
  10. strategy.entry("short", strategy.short, when=GoShort)
  11. //strategy.close("long", when=KillLong)
  12. //strategy.close("short", when=KillShort)
  13. strategy.exit("XL", from_entry = "long", loss = 60, profit=120)
  14. strategy.exit("XS", from_entry = "short", loss = 60, profit=120)
  15. strategy.exit("XL-logical", from_entry = "long", when=KillLong)
  16. strategy.exit("XS-logical", from_entry = "short", when=KillShort)
  17.  
  18. plot(rsi(close,14), color=orange)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement