Flagging out-of-sync open positions that have been closed by a strategy
Author: superticker
Creation Date: 8/21/2015 1:36 PM
profile picture

superticker

#1
Occasionally, a strategy will close a position (generate a sell Alert), but I'll decide I want to keep it anyway, which is a feature I like about Wealth-Lab. But I then forget about these forlorn positions and fail to sell them later--losing money.

Is there a simple way to quickly flag out-of-sync positions that have been closed by a strategy but remain open in my actual portfolio? If there isn't a way, can this feature be added in a future WL release? ... perhaps an out-of-sync position pane on the the Strategy Monitor window corresponding to the highlighted strategy instance(s) above.

One reason for this feature (besides not losing money on forlorn positions) is to routinely perform a reality check on strategies that may be selling too soon and need tweaking.
profile picture

Cone

#2
In short, no.

Strategies don't have access to live account positions. They always run in a hypothetical "test" mode. There's always a chance of out-of-sync positions (for limit orders and much more rarely for stop orders) even if you are following the strategy precisely. This case is discussed in the User Guide > Portfolio Synch > Theoretical vs. Actual topic.

A Trading Preference exists, however, to synch an Alert's shares to the full position held in an account, but this conversion is done at the Orders tool level, not at the Strategy level.
profile picture

superticker

#3
I know about the out-of-sync problem with limit orders, which the User Guide discusses. I also have Portfolio Synch enabled and Exit Full Positions enabled in preferences. Most of these out-of-sync positions occur because I choose not to follow the recommendation of the Alert (which is a WL feature I like), but it creates problems down the road when the forlorn position really needs to be sold later.

If you could add an out-of-sync display feature (pane) to either the Strategy Monitor window or the Accounts window, that would be great. And it would save me some money. :)

----

One work around would be to parse the Accounts.xml file (see link below, and thanks Eugene for those details) ...
https://www.wealth-lab.com/Forum/Posts/Alerts-pane-for-the-Account-Balances-and-Positions-window-37775

... and compare that to what positions are currently held in the Positions object. Since this parsing must come after the trading loop (so the Positions object is current), would the correct place for this parsing be in a Performance Visualizer module? (I've never written one of those before.)

But having this feature directly integrated into a pane for either the Strategy Monitor or Accounts window(s) would be best. Please add this to your things-to-do list.
profile picture

Eugene

#4
QUOTE:
But having this feature directly integrated into a pane for either the Strategy Monitor or Accounts window(s) would be best. Please add this to your things-to-do list.

Sorry but customizing the GUI to account for single-user solutions is not considered by Fidelity.

QUOTE:
Since this parsing must come after the trading loop (so the Positions object is current), would the correct place for this parsing be in a Performance Visualizer module?

Your understanding is correct. You'd want to query the SystemResults.Positions object for a list of the individual Positions generated by the Strategy and included in the backtest. An example of an open source performance visualizer can be found here after logging in to the Wiki: MS123 Visualizers > Download Project Source Code (previous generation 2012.07 demo)
profile picture

superticker

#5
I'll look at writing some type of performance visualizer as you suggested sometime in the future. Thanks for the link and coaching about when a performance visualizer was required. I initially thought about developing this solution "inside" a strategy (which is coding I'm already familiar with), but was concerned about whether or not the SystemResults.Positions object would be stable, which my solution would rely upon. Your answer confirms strategy code is the wrong place to develop this; it belongs in a Performance Visualizer post-trading module instead.

I was never suggesting a GUI just for me. I think an out-of-sync positions pane is an enhancement to the Strategy Monitor (or Accounts?) window everyone can use in a future release. Certainly I'm not the only one that has trouble with portfolio re-synchronization. The main problem with unidentified forlorn positions is that the strategy no longer manages (tracts) them (for sale). They eventually fall in value but are never recommended (by Alerts) for sale.

As I think about the implementation of an out-of-sync positions pane, I'm beginning to realize it needs to be associated with "a strategy" because its computation depends on the SystemResults.Positions object, which is associated with a strategy, and not a real portfolio. So adding this pane to the Strategy Monitor window where individual instances of strategies can be selected makes sense. In contrast, adding this pane to the Accounts window really doesn't. Moreover, the pane could only appear post-execution to a strategy after the SystemResults.Positions object is stable. Hmmm,... well the Strategy Monitor window could still display the out-of-sync positions pane after the strategy executes,... but so could a Performance Visualizer. Perhaps now I'm seeing where you're coming from; a performance visualizer module may make the most "implementation sense" for this.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).