add avg_loss.c and avg_gain.c