I am trying to code the difference between two prices from a plot, for which I need a precise result. For example, if the prices are 1.7815 and 1.7818 on the plot, I should get an absolute difference of 0.0003, but on some bars I am +1 or -1 out. Neither of the 2 codes below works all the time. I have tried “MidpointRounding.AwayFromZero”, but that gives similar results. From a read of the information online, I think “MidpointRounding.ToNegativeInfinity”(The strategy of downwards-directed rounding, with the result closest to and no greater than the infinitely precise result) would work, but this is not available in Ninjascript. Any ideas would be welcomed.
Values[12][0] =(Math.Abs(Values[6][5]-Values[6][0]));
Values[12][0] =(Math.Abs(Math.Round(Values[6][5],4)-Math.Round(Values[6][0],4)));
Thank you.

Comment