Support Board
Date/Time: Sat, 23 Nov 2024 17:51:55 +0000
Post From: ACSIL Custom Autotrading System assistance
[2024-08-09 15:54:30] |
User431178 - Posts: 541 |
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; |