Why is it ok to backtest on TradingView from now on!
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Peter_O

//@version=4
strategy(title = "NoBackTestBugAnymore", overlay = true, 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) 

GoLong=crossover(rsi(close,14),20) 
GoShort=crossunder(rsi(close,14),80) 
KillShort=GoLong 
KillLong=GoShort 

strategy.entry("long", strategy.long, when=GoLong) 
strategy.entry("short", strategy.short, when=GoShort) 
strategy.close("long", when=KillLong) 
strategy.close("short", when=KillShort) 
strategy.exit("XL", from_entry = "long", loss = 40, profit=30) 
strategy.exit("XS", from_entry = "short", loss = 40, profit=30)