Skip to content

Instantly share code, notes, and snippets.

@yongghongg
Created July 24, 2022 13:42
Show Gist options
  • Save yongghongg/9544a85df4acafa6de64781aa4e91a10 to your computer and use it in GitHub Desktop.
Save yongghongg/9544a85df4acafa6de64781aa4e91a10 to your computer and use it in GitHub Desktop.
macd = MACD(df, 12, 26, 9)
stochastic = Stochastic(df, 14, 3)
plots = [
mpf.make_addplot((macd['macd']), color='#606060', panel=2, ylabel='MACD (12,26,9)', secondary_y=False),
mpf.make_addplot((macd['signal']), color='#1f77b4', panel=2, secondary_y=False),
mpf.make_addplot((macd['bar_positive']), type='bar', color='#4dc790', panel=2),
mpf.make_addplot((macd['bar_negative']), type='bar', color='#fd6b6c', panel=2),
mpf.make_addplot((stochastic[['%D', '%SD', 'UL', 'DL']]), ylim=[0, 100], panel=3, ylabel='Stoch (14,3)')
]
mpf.plot(df, type='candle', style='yahoo', mav=(5,20), volume=True, addplot=plots, panel_ratios=(3,1,3,3), figscale=1.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment