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.
bardistparameter 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='') )
hans last edited by
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:
OHLCbars in which the 4 components have the same value?
With no reference code/information, any statement would be a simple guess.
hans last edited by backtrader
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
matplotlibmakes 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
BuySellobserver 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 like
3.5and the top of the axis (already inside the observer) indicates that everything has to be multiplied by
The scale is wrong obviously because it goes from
Probably your case too.