Back to problems

Compute EMA Indicators and Detect Crossovers in Pandas

Algorithm · Squarepoint · Medium

Given a time-ordered series of prices price containing n values, along with two span parameters span_short and span_long where span_short 0, or switching from >= 0 to < 0. Return the crossover indices as a list in increasing order. Implement this as compute_ema_crossovers(price, span_short, span_long). The solution must contain no for or while loops, and it must not scan the data using min/max. Vectorized Pandas/Numpy primitives such as diff, shift and sign are permitted.…

Checking your access…