Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Need help creating a "Buy" signal when divergence is a certain value (MACD)

I need help creating an algorithm that signals a "buy" when the divergence is some number (say -.2) and a "sell" or perhaps a "short" when the divergence is equal to +.2.
Fast period = 5 days
Slow period = 10-20 days
Signal line = 9-15 days
The algorithm attached is what I was working on before regarding AMD, it is just a simple MACD that buys when the MACD and signal line converge, this does not have the divergence magnitude in it (I do not know how to do this).
Any help would be great!