You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all, I am implementing an EMA Crossover Strategy and have ran into a problem. Whenever I set my stop loss percent less than 2, backtesting won't trades even though EMA crossing signals are met. My code is below:
class EmaCross(Strategy):
# NOTE: These values are also used on the website!
tp_p = tp
sl_p = sl
def init(self):
self.ema_fast = self.I(ema_fast, self.data)
self.ema_slow = self.I(ema_slow, self.data)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all, I am implementing an EMA Crossover Strategy and have ran into a problem. Whenever I set my stop loss percent less than 2, backtesting won't trades even though EMA crossing signals are met. My code is below:
`def ema_fast(data):
ema_fast = ta.ema(data.Close.s, length = 12)
return ema_fast.to_numpy()
def ema_slow(data):
ema_slow = ta.ema(data.Close.s, length = 21)
return ema_slow.to_numpy()
class EmaCross(Strategy):
# NOTE: These values are also used on the website!
tp_p = tp
sl_p = sl
def init(self):
self.ema_fast = self.I(ema_fast, self.data)
self.ema_slow = self.I(ema_slow, self.data)
I was wondering if there is anything wrong with my code and can someone quick check this with your data? Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions