def linear_weighted_moving_average(data, period):
catch_errors.check_for_period_error(data, period)<EOL>idx_period = list(range(<NUM_LIT:1>, period+<NUM_LIT:1>))<EOL>lwma = [(sum([i * idx_period[data[idx-(period-<NUM_LIT:1>):idx+<NUM_LIT:1>].index(i)]<EOL>for i in data[idx-(period-<NUM_LIT:1>):idx+<NUM_LIT:1>]])) /<EOL>sum(range(<NUM_LIT:1>, len(data[idx+<NUM_LIT:1>-period:idx+<NUM_LIT:1>])+<NUM_LIT:1>)) for idx in range(period-<NUM_LIT:1>, len(data))]<EOL>lwma = fill_for_noncomputable_vals(data, lwma)<EOL>return lwma<EOL>
Linear Weighted Moving Average.

Formula:
LWMA = SUM(DATA[i]) * i / SUM(i)