I would like to plot signals on my chart is there is a way to do it on candle stick? I did the following and got stuck :(
!pip install yfinance
!pip install mplfinance
import yfinance as yf
import mplfinance as mpf
import numpy as np
import pandas as pd
df=yf.download('BTC-USD',start='2008-01-04',end='2021-06-3',interval='1d')
buy=np.where((df['Close'] > df['Open']) & (df['Close'].shift(1) < df['Open'].shift(1),1,0)
fig = plt.figure(figsize = (20,10))
mpf.plot(df,figsize=(20,12),type ='candle',volume=True);
# any idea how to add the signal?
import yfinance as yf
import mplfinance as mpf
import numpy as np
df = yf.download('BTC-USD', start='2008-01-04', end='2021-06-3', interval='1d').tail(50)
buy = np.where((df['Close'] > df['Open']) & (df['Close'].shift(1) < df['Open'].shift(1)), 1, np.nan) * 0.95 * df['Low']
apd = [mpf.make_addplot(buy, scatter=True, markersize=100, marker=r'$\Uparrow$', color='green')]
mpf.plot(df, type='candle', volume=True, addplot=apd)
I just added .tail()
for better visualization.
Output: