Any live trading examples strategy using MACD

@QN_Liza, Looking to see similar trading strategies as SMA but using MACD indicator
Would you know of any or the code to convert from using the sma to macd


I’ve been using the MACD from the same library,

you can import it doing:

from pyti.moving_average_convergence_divergence import moving_average_convergence_divergence as macd 

you can then use it as follows: macd(data, short_period, long_period)

hope it helps

1 Like

Hi @Femi.lewis, we haven’t done any MACD sample strategies yet but I would echo @Jens comment, pyti is a great library for technical indicators.
I’ve also seen many people use TA Lib which has a MACD indicator, but I’ve yet to use that one personally.

1 Like

Thanks @QN_Liza , @Jens was just wondering about how to implement the crossover/ crossunder strategies

If you’re looking for crossesOver and crossesUnder functions, you can find an example in an RSI strategy Rob wrote:

I searched for a few example MACD strategies and many of them don’t actually use a MACD indicator but rather define the MACD and signal line manually using fast/slow EMAs, and then compare the signal line to zero to generate the trading signal. Here’s a pretty cut and dry example from Trading View: (edit: This is not my strategy nor have I tested it so please test before use!)

Ahh ok many thanks liza

You’re welcome! Let me know how it goes

1 Like