I am trying to code an Intraday Intensity oscillator, involving only some very simple arithmetic - however, the calculation is failing. I have been adding parts of the calculation into a test script to pinpoint where the issue is, and it appears to be with the following division for 'tempval3':
double tempval1 = ((2*Close[0]) - High[0] - Low[0]);
double tempval2 = (High[0]-Low[0]);
double tempval3 = tempval1/tempval2;
temp.Set(tempval2);
Print(tempval3);
I_Intensity.Set(temp[0]);
I can plot tempval1, no problems. The same applies to tempval2, but no plot shows for tempval3.
In the output window, I notice that tempval3 is returning lots of -1 and 1 values, and also NaN occasionally.
Any ideas why this could be - as far as I can see I am only asking for the most basic of arithmetic here?
Thanks in advance
Julian
Comment