Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Issue calculating EMA in opening minutes

Hi all

I was tinkering around with talib.MA with minutely data to get the 8EMA when I realized the results were wrong for the minutes just after the market open.

Example: At 9:33AM try to get the minutely 8ema. That should use the timeframe 9:25-9:33, but instead seems to use 3:54-4:00PM from the previous day and 9:31-9:33AM from the current day.

Anyone else know how to work around this? Possibley get pre-market data? Instead of waiting until 9:39AM to do calculations.

Thanks!
KB

2 responses

The opening minutes are kind of a shit show anyways. You're better off employing special logic or just avoiding that time frame all together. Algorithms aren't necessarily the best choice for the opening minutes unless your goal is to take a calculated gamble based on prior trends, in which case you would not be referencing the moving average.

And premarket is equally unreliable and easily manipulated.

Hi James - thank you for the advice - I agree with the opening minutes.

I actually was wondering about calculating EMAs just after the opening minutes because what I'm really trying to do is calculate the 8ema for 15 minute bars during the morning (before 11:30am; when you have less than 120 minutes to calculate from).