I created a simple indicator using the ninja indicator wizard. But the values being dispalyed and plotted do not align with the same data processed through the same equation in excel. I have provided my code and how I tested the values...wondering if you have any ideas why the values ( angles ) I calculate are not the same....
I inserted the following code where appropriate in my simple indicator
if (CurrentBar < 2)
return;
double delta_ema60 = EMA(60)[0] - EMA(60)[1];
double ema60angle = Math.Atan( delta_ema60 )*57.29577;
EMA60.Set( Math.Abs(ema60angle) );
I next tried to validate the values returned using an excel formula. This formula was as follows:
angle_excel = ATAN(delta)*57.29577
Note1 delta is defined as the EMA[0] - EMA[1] (current - previous)
Note2 I validated the excel angles using a hand held calculator
Note3 I realize the source code using the ABS function, but it's N/A with data I tested with
The following is data I obtained from the Data Window using 1 minute bars for the SnP Emini on 8/24/09 along with the angle I belive it should be...
time EMA60 delta angle_ninja angle_excel
8/24/09 14:00:00 1024.08 N/A N/A N/A
8/24/09 14:01:00 1024.14 0.06 3.13 3.433629792
8/24/09 14:02:00 1024.19 0.05 3.03 2.862404751
8/24/09 14:03:00 1024.24 0.05 2.93 2.862404751
I would expect these angles to be the same. More of a concern is the angle_ninja for 14:02 and 14:03, the angle should be the same becasue the delta value are the same. Any ideas?
thanks,
-t
Comment