updated with new Moving Average
update with exception handling