diff --git a/IB-Tracker/src/Config/Config.h b/IB-Tracker/src/Config/Config.h index 4687173..64ac51d 100644 --- a/IB-Tracker/src/Config/Config.h +++ b/IB-Tracker/src/Config/Config.h @@ -26,7 +26,7 @@ SOFTWARE. #pragma once -constexpr std::wstring version = L"2.4.2"; +constexpr std::wstring version = L"2.4.3"; bool SaveConfig(); bool LoadConfig(); diff --git a/IB-Tracker/src/Database/trade.cpp b/IB-Tracker/src/Database/trade.cpp index 9e5e7f9..e4bbcec 100644 --- a/IB-Tracker/src/Database/trade.cpp +++ b/IB-Tracker/src/Database/trade.cpp @@ -66,6 +66,9 @@ void Trade::setTradeOpenStatus() this->isOpen = (aggregate == 0 ? false : true); return; } + + // If the Trade is closed then set the latest Buying Power date tot he close date + this->BPendDate = this->OldestTradeTransDate; } diff --git a/IB-Tracker/src/Utilities/ListBoxData.cpp b/IB-Tracker/src/Utilities/ListBoxData.cpp index d31c721..b089352 100644 --- a/IB-Tracker/src/Utilities/ListBoxData.cpp +++ b/IB-Tracker/src/Utilities/ListBoxData.cpp @@ -435,8 +435,8 @@ void ListBoxData_TradeROI(HWND hListBox, const std::shared_ptr& trade, Ti COLOR_WHITEDARK, font8, FontStyleRegular); // Days In Trade - int days = AfxDaysBetween(startDate, (trade->isOpen ? AfxCurrentDate() : endDate)); - text = AfxMoney(days, true, 0); + int daysInTrade = AfxDaysBetween(startDate, (trade->isOpen ? AfxCurrentDate() : endDate)); + text = AfxMoney(daysInTrade, true, 0); ld->SetData(4, trade, tickerId, text, StringAlignmentFar, StringAlignmentCenter, COLOR_GRAYDARK, COLOR_WHITELIGHT, font8, FontStyleRegular); text = L"DIT"; @@ -446,18 +446,18 @@ void ListBoxData_TradeROI(HWND hListBox, const std::shared_ptr& trade, Ti // Totals Days for Trade ld = new ListBoxData; - days = AfxDaysBetween(startDate, endDate); - text = AfxMoney(days, true, 0); + int daysTotal = AfxDaysBetween(startDate, endDate); + text = AfxMoney(daysTotal, true, 0); ld->SetData(2, trade, tickerId, text, StringAlignmentFar, StringAlignmentCenter, COLOR_GRAYDARK, COLOR_WHITELIGHT, font8, FontStyleRegular); text = L"Days"; ld->SetData(3, trade, tickerId, text, StringAlignmentNear, StringAlignmentCenter, COLOR_GRAYDARK, COLOR_WHITEDARK, font8, FontStyleRegular); - // ROI% per 30 days + // ROI% per 30 days text = AfxMoney(0, true, 1) + L"%"; - if (trade->TradeBP != 0 && days != 0) { - text = AfxMoney((trade->ACB / trade->TradeBP * 100 / days * 30), true, 1) + L"%"; + if (trade->TradeBP != 0 && daysTotal != 0) { + text = AfxMoney((trade->ACB / trade->TradeBP * 100 / daysTotal * 30), true, 1) + L"%"; } ld->SetData(4, trade, tickerId, text, StringAlignmentFar, StringAlignmentCenter, COLOR_GRAYDARK, COLOR_WHITELIGHT, font8, FontStyleRegular);