Closed crack00r closed 6 years ago
I had the same problem. The error is in the EMA and MACD functions. When you comment them out the code runs because they are not used (yet) in backtest.py
# x = numpy.asarray(prices)
# weights = None
# weights = numpy.exp(numpy.linspace(-1., 0., period))
# weights /= weights.sum()
# a = numpy.convolve(x, weights, mode='full')[:len(x)]
# a[:period] = a[period]
# return a
#def MACD(self, prices, nslow=26, nfast=12):
# emaslow = self.EMA(prices, nslow)
# emafast = self.EMA(prices, nfast)
# return emaslow, emafast, emafast - emaslow
Sorry about that. I'll get that fixed this weekend.
root@j314793:/trading-bot/part 3# python backtest.py Traceback (most recent call last): File "backtest.py", line 4, in
from botstrategy import BotStrategy
File "/root/trading-bot/part 3/botstrategy.py", line 2, in
from botindicators import BotIndicators
File "/root/trading-bot/part 3/botindicators.py", line 23
return a
SyntaxError: 'return' outside function
root@j314793:/trading-bot/part 3#