Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Noob- Moving averages

I need help writing a formula daily time frame.

I would like to see if this is a profitable system.

High - Moving Average (simple 8 day) > Moving Average( simple 8 day) - Moving Average (simple 20 day)

Once I have these events,
a) does price break the 20 simple moving average
b) if it does, how long does it take till it breaks the 20-day SMA.

I want to do this on ETF's, SPY, QQQ, etc.

How would I start to write this code, get the statistical probabilities and then backtest it?

2 responses

Assuming you actually want to use a MA and not an EMA, just use mean after calling the data values. Then set your universe to those ETFs. You can then use the backtest to figure out your probabilities.

Yea I don't think we are talking about the same, but thank you for your time.