the present day range

 
Please I am not a programmer, and need a very simple indicator. Somebody can say me like doing it? , I need an indicator that says the present day rank (range) of the price until this moment (difference between the maximum and the present minimum), and in addition, the average rank of last five days. Those are few data that handle, but I not like confronting it, please, request aid. Thank you very much.
 
the present day rank (range) is
double range = iHigh(NULL, PERIOD_D1, 0) - iLow(NULL, PERIOD_D1, 0);



the average rank of last five days is

double avr_range = 0;
int N = 5;
for (int i=0; i < N; i++)
{
  avr_range += iHigh(NULL, PERIOD_D1, i) - iLow(NULL, PERIOD_D1, i);
}

avr_range /= N;





 
Thank you very much RickD by your aid, already I have it working. Thank you very much
Reason: