Login Page - Create Account

Support Board


Date/Time: Fri, 12 Sep 2025 10:24:18 +0000



Post From: ACSIL Custom Autotrading System assistance

[2024-08-09 15:54:30]
User431178 - Posts: 773

double volumeDifference = volumeAtPriceData.AskVolume - volumeAtPriceData.BidVolume;

Both volumeAtPriceData.AskVolume and volumeAtPriceData.BidVolume are unsigned integers (uint32_t), so you will not get a correct result if BV > AV.
Even though you have the result as a double, the subtraction on the right hand side happens first, the result of which is then converted to double.

For it to work correctly for negative numbers you would need to do somthing like one of the options below.


double volumeDifference = (volumeAtPriceData.AskVolume * 1.0) - volumeAtPriceData.BidVolume;


double volumeDifference = static_cast<double>(volumeAtPriceData.AskVolume) - volumeAtPriceData.BidVolume;


int64_t volumeDifference = static_cast<int64_t>(volumeAtPriceData.AskVolume) - volumeAtPriceData.BidVolume;