In need of support with more indicators in a screener
I've been following the blog post on creating a screener on the basis of an Analyzer. Background being that i want to screen the S&P500 stocks at end of day to scan if a stock shows the signals I'm looking for.
I've been trying several ways, but my python skills are not sufficient I think. Below my try, I would appreciate if somebody could point me in the right direction.
class Screener(bt.Analyzer): params = dict(period=10) def start(self): self.smas = [bt.indicators.SMA(self.datas, period=self.p.period) for data in self.datas] self.trend_ema = [bt.indicators.ExponentialMovingAverage(data, period=200) for data in self.datas] self.adx = [bt.indicators.ADX(data, period=10) for data in self.datas] self.result = zip(self.datas, self.smas, self.crsi, self.trend_ema, self.adx) def stop(self): self.rets['over'] = list() self.rets['under'] = list() for value, sma, trend_ema, adx in self.result node = data._name, data.close, crsi if value > trend_ema and adx >= 30 self.rets['over'].append(node)
What's the problem your code poses?
Obviously you haven't run that code, because to start with you have something called
self.crsiwhich doesn't exist but it is being put in a
I've been trying several ways, but my python skills are not sufficient I think.
Let me be blunt. Programming skills are a pre-condition.
If this is a contest, here is my list:
- FPGA programming
- Assembly for Motorola and Intel (MASM, TASM and gas)
- C ... down to the OS kernel
- C64 Basic (No ... the Motorola Assembly was not on a C64)
- Visual Basic
- dBase III (you could create fairly complicated things with nice character based GUIs)
Under SunOS, Solaris, Linux, DOS, Win32, IRIX, C64, Web Browsers and Proprietary Environments (not all at the same time, not with all the languages obviously)
And that's why I learnt that to ask for help/support I had to post something which was what I was actually trying to run (or running but with problems), what the input/output was, what I thought the problem was, what error was being shown., ...
Now that the "mine is larger" contest is over ...
- An isolated and redacted piece of code which isn't executable and has obviously never been put to the test to see if it executes ... doesn't help.