B
Bill Cunningham
I have written this function and changed it and re written it and it
just doesn't do what I want it too. It is supposed to calculate the RSI for
avg up and down prices of a commodity. I compile this into an .o file and
link with a .c file.
double rsi(double up, double down, int period)
{
double rsi, up_avg, down_avg;
up_avg = up / period;
down_avg = down / period;
rsi = ((up_avg + down_avg) / up_avg) * 100;
printf("%.3f\n", rsi);
return 0;
}
I have tried reversing the division of up and down_avg. There must be
something wrong here.
Bill
just doesn't do what I want it too. It is supposed to calculate the RSI for
avg up and down prices of a commodity. I compile this into an .o file and
link with a .c file.
double rsi(double up, double down, int period)
{
double rsi, up_avg, down_avg;
up_avg = up / period;
down_avg = down / period;
rsi = ((up_avg + down_avg) / up_avg) * 100;
printf("%.3f\n", rsi);
return 0;
}
I have tried reversing the division of up and down_avg. There must be
something wrong here.
Bill