I have the following script and I want to round up the Value to the nearest one integer. It does not work as intended, instead it rounds up to the nearest 10. Please advise how do I modify it the round up to the nearest 1?
protected override void OnBarUpdate()
{
// Multiplying the high, low, and close values by 4
double high0 = MultiplyByFour(High[0]);
double low0 = MultiplyByFour(Low[0]);
if (CurrentBar == 0)
{
Value[0] = high0 - low0;
}
else
{
double close1 = MultiplyByFour(Close[1]);
double trueRange = Math.Max(Math.Abs(low0 - close1), Math.Max(high0 - low0, Math.Abs(high0 - close1)));
Value[0] = ((Math.Min(CurrentBar + 1, Period) - 1) * Value[1] + trueRange) / Math.Min(CurrentBar + 1, Period);
Value[0] = Math.Round(Value[0]);// Round the ATR value to the nearest integer
}
Thank you
CW
Comment