This repository was archived by the owner on Mar 24, 2023. It is now read-only.
Changing Markers #79
Unanswered
ismailbayram
asked this question in
Q&A
Replies: 1 comment
class CurrentPositionObserver(bt.observers.Observer):
lines = ('long_pos', 'short_pos')
plotinfo = dict(plot=True, subplot=False,
plotname='Positions',
plotymargin=0.4, plotlinelabels=True,
plothlines=[0.0])
plotlines = dict(
long_pos=dict(_name='Long', color='lime'),
short_pos=dict(_name='Short', color='red')
)
def next(self):
diff = self._owner.broker.getvalue() - self._owner.broker.getcash()
if diff > 0:
self.lines.long_pos[0] = self._owner.dataclose[0]
elif diff < 0:
self.lines.short_pos[0] = self._owner.dataclose[0]I think, I can resolve the problem with a custom observer. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Hi there,
Firstly thanks for this great library. My question is: How can I change markers of buy/sell orders? For example I open a buy position and close it. But marker of opening short position and marker of close buy position are same. I would like to label exit short/exit long.
Current Markers:

Desired Markers:
All reactions