def detrended_price_oscillator(data, period):
catch_errors.check_for_period_error(data, period)<EOL>period = int(period)<EOL>dop = [data[idx] - np.mean(data[idx+<NUM_LIT:1>-(int(period/<NUM_LIT:2>)+<NUM_LIT:1>):idx+<NUM_LIT:1>]) for idx in range(period-<NUM_LIT:1>, len(data))]<EOL>dop = fill_for_noncomputable_vals(data, dop)<EOL>return dop<EOL>
Detrended Price Oscillator.

Formula:
DPO = DATA[i] - Avg(DATA[period/2 + 1])