@Pablo-Reyes-Almagro It works! thx!
Best posts made by yoghurtshawn
Latest posts made by yoghurtshawn
RE: Forbid short selling
It seems this LongOnly sizer could do the trick. Right?
class LongOnly(bt.Sizer): params = (('stake', 1),) def _getsizing(self, comminfo, cash, data, isbuy): if isbuy: return self.p.stake # Sell situation position = self.broker.getposition(data) if not position.size: return 0 # do not sell if nothing is open return self.p.stake
RE: Idiomatic way for adding multiple ibstore live data with different resampling and the same backfill start date
I found a similar exception as well. Does anyone have some idea about this problem?
Multicore Optimization and self define analyzers
As you said in this topic:
The problem is that you have to store the PnL value in the stop method of the Strategy. Because unless you do that you talk to the last instance of the PnL which cerebro keeps record of. (With maxcpus > 1 it would be the same)
What if I had a self defined analyzers which requires store some values in stop method. How can I modify my codes so that multi core opt could work properly, instead of error: AttributeError: Can't get attribute 'Lines_LineSeries_LineIterator_DataAccessor_ObserverBase_Observer_DataTrades_bd546845b4ba4f7489a48e0b65e9bec2
RE: Does not trade correctly when use Volume Filler
Anybody knows the reason?
Does not trade correctly when use Volume Filler
I found it did not work correctly when using the filler.
For example, I buy with a sizer of 3 every time, and set the filler to be FixedSize 1.
There should be three OrderExecutionBit Objects in order.executed, with index p1, p2.
However, I found 6 exbits were actually executed.
[exbit0, exbit1, exbit2]
- execute exbit0, (p1 = 0, p2 = 1, len = 1)
- execute exbit0, exbit1, (p1 = 0, p2 = 2, len = 2)
- execute exbit0, exbit1, exbit2 (p1 = 0, p2 = 3, len = 3)
It seems like p1 is set to 0 all the time, which might be the problem.
Daily summary on 1min level backtest
When I was doing backtest based on 1min kline data, could I also get analysis on daily performance, like daily trades profits, win/loss counts, daily drawdown, etc, say return in a list (one value per day.)