@self-quant said in Indicator Woes:
Note: If I replace self.rsi = bt.talib.RSI( self.data.close, period=self.params.rsiperiod)
We don't know which values your output produces and why you think some are right and some are wrong. But I am pretty sure that the RSI indicator from talib doesn't take a period parameter. That could simply be it ...
The TA-LIB docs: http://mrjbq7.github.io/ta-lib/doc_index.html
@bernardlin said in TradeAnalyzer appears to be incorrect:
Hi, I changed traderanalyzer.py file script as instructed on Github
I fear you didn't simply use the development branch. There is no reason to manually change/download a single file.
@jacob said in Does Backtrader support Parallel Strategies?:
clearly for it to work as intended in Backtrader more work on both store and broker is needed.
Actually it is a general design practice. You shouldn't block the main thread of any running program. If you see the GUI of an application freezing, it is because things are being blocked in the main thread and the OS has no chance to keep the GUI updated.
The design which backtrader has is also asynchronous (which is in many occasions what people take as event-based), because your code is called when it needs to be called
Order has been executed
To keep things simple there are simplifications like:
notify_cash won't be called for each update, but only when your next iteration is going to be called
The rationale is that you only care about your cash in the same timeframe that you are operating on.
@rstrong said in Indicators for datas with less periods than the indicator requires:
However if the indicator was ATR for example, I would want the ATR of the last 3 periods until it hits 14 periods and then be 14 after that.
The only way to do that as pointed out by @ab_trader is to do the calculations manually in next and the declared period of your indicator has to be 3 (without taking into account that the value should be a parameter a not a fixed value)
If you use internally the built-in ATR, the platform will know there is an ATR with period 14 (which actually ends up with a higher effective period due to the internal constraints of the indicator) and that will be the period of your indicator.
To overcome this you need to:
Send each prenext call to next
Check the actual len(self) > 14 or even better the length of the longer ATR if len(atr_14) > 0
If the comparison succeeds deliver the value of the longer indicator
If not, deliver the value of the smaller ATR of period 3.
In any case there will be an initial period in which you cannot deliver anything, because the ATR of period 3 cannot also deliver until its minimum constraints have been met.
Drawdown analyzer works with the historical broker value curve. You calculate your results based in closed trades equity, no in-trade drawdowns are considered. The results should be different in most of the cases.
It's not a perfect solution. Because the original definition of the RSI doesn't have provisions for the case in which a DivisionByZero happens. This only happens when the prices don't change over time, which was possibly not contemplated by the author, back then.
I'm going to deep-dive in the platform once again from the beginning, so then hopefully those questions/topics will be clearer.
Don't you consider having a discord channel for very interactive chats?
@sfkiwi said in DivideZeroError on some indicators:
Ok but, unlikely as it is, the price stayed stationary for more than 20mins so shouldn't the indicators still be protected from a divide by zero error?
Nobody has claimed nothing about the price or the protection. Only that you said something was broken without posting any code or data. And when the code and data were posted, the error was somewhere else. Hence the need to post something sensible.
Extends the Bollinger Bands with a Percentage line
lines = ('pctb',)
params = (('safediv', False), ('safezero', 0.0))
plotlines = dict(pctb=dict(_name='%B')) # display the line as %B on chart
if not self.p.safediv:
self.l.pctb = (self.data - self.l.bot) / (self.l.top - self.l.bot)
self.l.pctb = DivByZero(self.data - self.l.bot, self.l.top - self.l.bot, self.p.safezero)
params = (('safediv', True),)
That's something you can directly use in your code. There is no need for a fork to do that.