added calculate_moving_lines