I have tried fixing my code to backtest my strategy and when I try to backtest it, it tells me that my code couldn't complete any trades. Please help I am in dire need.
Here is the code:
//version=4
strategy("backtest #001", overlay=true, initial_capital=100000, currency='USD')
//backtest
fromYear = year > 2010
toYear = year < 2020
//inputs
mystoch = stoch(close, 14, 3, 3) >= 85
myema = ema(close, 200) >= ema(close, 200)
mybbw = bbw(close, 20, 2) >= 0.03
//closing inputs
mystochclose= stoch(close, 14, 3, 3) <= 40
myemaclose = ema(close, 200) <= ema(close, 197)
mybbwclose = bbw(close, 20, 2) <= 0.03
//problems
strategy.entry('buy', true, 1, when = (mystoch and myema and mybbw)? 1 : 0)
strategy.close("buy", when = (mystochclose and myemaclose and mybbwclose)? 1 : 0) , qty_percent = 50
Here is the code:
//version=4
strategy("backtest #001", overlay=true, initial_capital=100000, currency='USD')
//backtest
fromYear = year > 2010
toYear = year < 2020
//inputs
mystoch = stoch(close, 14, 3, 3) >= 85
myema = ema(close, 200) >= ema(close, 200)
mybbw = bbw(close, 20, 2) >= 0.03
//closing inputs
mystochclose= stoch(close, 14, 3, 3) <= 40
myemaclose = ema(close, 200) <= ema(close, 197)
mybbwclose = bbw(close, 20, 2) <= 0.03
//problems
strategy.entry('buy', true, 1, when = (mystoch and myema and mybbw)? 1 : 0)
strategy.close("buy", when = (mystochclose and myemaclose and mybbwclose)? 1 : 0) , qty_percent = 50
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.