Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Attempted a MACD two lines cross over strategy.

This was an attempt at a MACD two lines cross over. I don't think the 9 day EMA line is right, but the program ran.

The MACD buy/sell strategy didn't work but the inverse did- sort of. The back test shows you would have lost all money before making a lot.

I'll work more on getting this right.
If anyone gets a working MACD two lines let me know. I'm interested to see what the back test does.

3 responses

Based on other examples on this site, I used deque and append to get a history of macd values and then divided the sum of the deque by the number of elements to get the average.

The main reason this algorithm seems to perform well is the huge amount of cash borrowed. System does not limit the negative cash position thus enabling one to borrow trillions. It seems like a good idea to put a limit to order execution that would honor more realistic margin borrowing.

Did you ever figure out why the inverse MACD works? And did you end up figuring out how to correctly do the macd two line crossover?