I have written this ob/os oscillator for securities analysis. The only
thing is that the result is always negative. Such as -96. I have looked over
and over this code and it looks fine to me. Is there any trouble?
#include <stdio.h>
#include <stdlib.h>
double os(double price,double ma)
{ double os;
os=price-ma/ma*100;
return os;
}
int main(int argc,char *argv[])
{ if (argc!=3)
{fprintf(stderr ,"usage error\n");
exit(EXIT_FAILU RE);
}
double price,ma;
price=strtod(ar gv[1],NULL);
ma=strtod(argv[2],NULL);
printf("%f.2\n" ,os(price,ma));
return 0;
}
Thanks.
thing is that the result is always negative. Such as -96. I have looked over
and over this code and it looks fine to me. Is there any trouble?
#include <stdio.h>
#include <stdlib.h>
double os(double price,double ma)
{ double os;
os=price-ma/ma*100;
return os;
}
int main(int argc,char *argv[])
{ if (argc!=3)
{fprintf(stderr ,"usage error\n");
exit(EXIT_FAILU RE);
}
double price,ma;
price=strtod(ar gv[1],NULL);
ma=strtod(argv[2],NULL);
printf("%f.2\n" ,os(price,ma));
return 0;
}
Thanks.
Comment