Change BuySell to "trade arrows" in charts #213
-
From Issue #213
This style of buy/sell annotation is much more common in literature then the current one implemented, which often gets overlapped by candlesticks and become difficult to see.
So basically it's just a matter of moving the arrows "out of the way" to not get overlapped by the candle bars.
-
Adjust the
bardist
parameter to move the arrows further away.You can also change the matplotlib markers to draw any arrow you like.
plotlines = dict( buy=dict(marker='^', markersize=8.0, color='lime', fillstyle='full', ls=''), sell=dict(marker='v', markersize=8.0, color='red', fillstyle='full', ls='') )
-
-
As far as I can see the arrows do not appear when working with tick data (at least not in my figures). Is that intended behaviour or possibly a bug?
-
Tick Data is a definition which seem to be controversial. Are you referring to:
-
OHLC
bars in which the 4 components have the same value? -
A
bid/ask
pair? -
A single
tick
value?
With no reference code/information, any statement would be a simple guess.
-
-
I created a simple csv with: datetime, price and volume (from a csv with bid/sell info). High, low, open and close point to the same price field:
data = bt.feeds.GenericCSVData( dataname='datafile.csv', fromdate=datetime.datetime(2010, 1, 1), todate=datetime.datetime(2010, 12, 31), nullvalue=0.0, dtformat=('%Y-%m-%d %H:%M:%S.%f'), datetime=0, high=1, low=1, open=1, close=1, volume=2, openinterest=-1 )
-
They are plotted. The problem arises because
matplotlib
makes assumptions about situations where the difference between the top and bottom of a plot is too small and could lead to problems.The plot below plots the
BuySell
observer on a different axis to make it clear: I am here. But cannot be seen with the data. The right axis ticks (Y) show values like3.5
and the top of the axis (already inside the observer) indicates that everything has to be multiplied by1000
(3.065e3
)The scale is wrong obviously because it goes from
0
to3.065
Probably your case too.