feat(AccountInfoDisplay): add per-trade max open PnL rows - #176
Open
AlbertoAmadorBelchistim wants to merge 2 commits into
Open
AlbertoAmadorBelchistim wants to merge 2 commits into
AlbertoAmadorBelchistim wants to merge 2 commits into
Conversation
Collaborator
|
The tracked value does not currently match the advertised per-trade metric. |
Adds two optional rows to the account info panel, both disabled by default so existing setups are unaffected: - Max open PnL: highest open PnL reached during the current trade, shown while a position is open on the selected account/instrument. - Last trade max PnL: the same value for the last closed trade, kept visible while flat. Useful to review how much unrealized profit a trade reached before it was closed (maximum favorable excursion). Tracking is runtime-only (no persistence): the state machine follows flat -> open -> flat transitions of TradingManager.Position, seeds the baseline with the portfolio open PnL at entry, and resets whenever the selected portfolio changes. The two toggle names and row labels are declared inline like the existing row labels in this file; no localization keys exist for them yet, so they follow the same transitional pattern as the Half Gap settings in DailyLines.
… of rendering The maximum was taken from Portfolio.OpenPnL, which also contains the PnL of other positions on the same account, and it was only sampled in OnRender, so peaks and position transitions between two frames were missed. A direct reversal was not recognized as a new trade. The value now comes from the chart position's own UnrealizedPnL. It is updated from OnPositionChanged and from the position's PropertyChanged notifications (raised on every PnL recalculation), not from rendering. The trade state follows the sign of the position volume: opening starts a trade, closing ends it, and a change of sign ends the current trade and starts a new one. Tracking is reset when the portfolio or the security changes.
AlbertoAmadorBelchistim
force-pushed
the
feat/accountinfo-max-open-pnl
branch
from
September 20, 2026 09:37
3806609 to
d5e27da
Compare
Contributor
Author
|
Thanks, reworked:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two optional rows to the account info panel, both disabled by default so existing setups are unaffected:
This makes it easy to see how much unrealized profit a trade reached before it was closed (maximum favorable excursion), directly on the panel traders already use to monitor PnL.
Implementation notes
TradingManager.Position(matching account and instrument), seeds the baseline with the portfolio open PnL at entry, and updates the maximum on each render.Localization
The two toggle names and row labels are declared inline, consistent with the existing row labels in this file ("Open PnL", "Balance", …). No matching keys exist in OFT.Localization yet, so they follow the same transitional pattern as the recently merged Half Gap settings in DailyLines, ready to be swapped once keys are added:
Testing
Built against Alpha configuration with 0 errors. Smoke-tested on chart: row appears on position open and only increases; on close the value moves to "Last trade max PnL" and persists while flat; switching accounts clears the state; both toggles off reproduces the previous panel exactly.