Alerts pane for the Account Balances and Positions window
Author: superticker
Creation Date: 7/1/2015 2:36 PM
profile picture

superticker

#1
It would be useful if the Account Balances and Positions window had an "optional" Alerts pane that would operate much like the one in the Quotes window. Specifically, I would like to be alerted whenever a position in my portfolio drops by more than 3% during a trading day.

----

As a workaround, please tell me if there's an easier way to construct a Quotes window of all my open positions.

1) Right click and copy the Account Balances and Positions window onto the clipboard.
2) Paste the clipboard into Excel.
3) Copy the Excel Symbols column into the clipboard.
4) Copy the clipboard Symbols into a new Wealth-Lab dataset.
5) Run a special strategy with Strategy Monitor on this WL dataset that will sell all positions with a 3% stop loss for the last bar.
6) Go to the Alerts pane of Strategy Monitor, and evoke the Monitor-in-Quotes-Window button on all Alerts.

Again, if you can think of a tricky way to shorten the above list in this workaround, please tell us. Just being able to combine steps 1 through 4 would be helpful.
profile picture

Eugene

#2
1 through 4 can be automated via AutoIT, for example. 2 and 3 (and Excel) can be replaced by an AutoIT script like this which would activate itself only when it senses on the clipboard the header string created by the Accounts window: Monitoring clipboard?

4 Why new? Can't you just have one fixed symbol but trade external symbols? The special strategy can receive the actual list of symbols from the clipboard or (with latest Community Components 2015.07) import the history of real trades from Wealth-Lab's Accounts tool directly. See open source code, ExtensionMethods\PositionEx.cs > CreateCsvFileFromAccountsXml if interested.
profile picture

Cone

#3
Use one strategy to:
1) parse Accounts.xml
2) obtain a list of the AccountPositions Symbols for the specified account (you'll need to inspect the file once manually), and
3) loop through the resulting list to generate Alerts.

Here's the path to Accounts.xml...
CODE:
Please log in to see this code.


Run the strategy on one symbol in the trading DataSet, and use SetContext() to generate the Alert for each symbol.
profile picture

superticker

#4
Thanks for all the suggestions. I never thought about using AutoIt with Wealth-Lab. That's an interesting thought for a number of operations I do. And I'll look at importing the history of trades from WL Accounts tool. I didn't realize that existed.

I also like the idea of parsing the Accounts.xml file. I didn't even realize that file existed.

So by parsing the Accounts.xml file, it should be possible to perform a real-time look at the price of any stock in one's portfolio. I never realized a strategy could do that. (I appreciate this isn't the most efficient approach. Employing intra-day bars would be better.)
profile picture

Eugene

#5
And here's a quick example of parsing Accounts.xml as Cone suggests. Add necessary references and pass an account number:

CODE:
Please log in to see this code.
profile picture

superticker

#6
I just looked at WL's .../Data/Accounts.xml file, and it only lists PaperTrading accounts, but no real portfolio accounts. Where can I find actual held positions in real accounts? I'm running WL 6.9.15.0.

Is there a public WL object that contains all currently held portfolio positions I can access?
profile picture

Eugene

#7
QUOTE:
Is there a public WL object that contains all currently held portfolio positions I can access?

I'm afraid there is none. Strategies don't have access to live account positions and they always run in a hypothetical mode.
profile picture

superticker

#8
Well, is there a way of getting at the information in the Accounts window? Certainly, there's an object somewhere in WL that generates that table of account data.

And I'm assuming the Accounts table is a Windows.Forms object that's available. What's the name of the instance of that Forms object?

-----

The primary problem is I want to determine what positions are out-of-sync with the strategy simulation. There's really no fool-proof way to prevent out-of-sync positions, and honestly, some out-of-sync positions are intentional. But if there's a good buying opportunity to bring a position back in sync with the simulation, I would like to take advantage of it.
profile picture

Eugene

#9
QUOTE:
And I'm assuming the Accounts table is a Windows.Forms object that's available. What's the name of the instance of that Forms object?

Please see answer to this FAQ: Is there a documentation for WealthLab.dll class procedures and methods? In short, a rule of thumb here is that you'll have to find it out by yourself under debugger or other tool - like with any undocumented methods.

QUOTE:
Well, is there a way of getting at the information in the Accounts window?

You have it above, in post #5. Not sure what Accounts.xml file you were looking at but I think that the IsPaperAccount tag is in mine for a reason (to differentiate between paper and live accounts, I guess):

Users\%username%\AppData\Roaming\Fidelity Investments\WealthLabPro\1.0.0.0\Data\Accounts.xml
profile picture

superticker

#10
My actual problem is that out-of-sync positions, which loose money 95% of the time, are constantly showing up. A few of these are intentional because I don't want to follow every Alert given. But many are not. So I want to plug the holes and manually monitor these out-of-sync positions so I'm not loosing money with them.

I'm not sure how we got started with PaperTrading accounts. I don't use them, and they are irrelevant to out-of-sync positions.

So Wealth-Lab should offer some supported method for monitoring what the actual portfolio is doing. The problem with unsupported "private" objects is that they are constantly breaking/changing with every new release. I realize the internals of Wealth-Lab are in flux (That's true of any evolving software product.), but there should be some supported API that breaks out what the actual portfolio is doing. Agreed?

I do like how WL performs a simulation without the influence of the real portfolio. That's essential in strategy development to determine the merits of the strategy without outside influences. Please don't change that.

----

My goal is the write a Performance Visualizer that would list out-of-sync positions so I can better keep my eye on them. Any pointers on which WL objects I should be using to identify the actual portfolio positions would be welcomed. I would prefer to use "public" objects if possible.
profile picture

Eugene

#11
QUOTE:
So Wealth-Lab should offer some supported method for monitoring what the actual portfolio is doing.

As per the User Guide > Orders > Portfolio Synch, Strategies always operate in a theoretical trading environment and can therefore become out-of-synch with your Live account. So it's highly unlikely that Fidelity would consider adding supported methods for that.
profile picture

superticker

#12
QUOTE:
As per the User Guide > Orders > Portfolio Synch, Strategies always operate in a theoretical trading environment and can therefore become out-of-synch with your Live account.
And as I said, I wouldn't do anything to change that. This is a good feature because it allows the strategy developer to evaluate the strategy (through simulation) without outside (portfolio) influences.

But for those positions that do become out-of-sync, they loose money 95% of the time. And the goal is to make money, so these out-of-sync positions need to be manually monitored; otherwise, they continue to loose money until they are discovered by happenstance.

So in the spirit of not loosing money unnecessarily, there should be a Performance Visualizer to monitor any out-of-sync positions. This visualizer has nothing to do with strategy simulation; that should remain unaffected.

---

On a separate note, I said some of the out-of-sync positions are intentional. This raises the question, should the strategy have included them or not? By manually monitoring these intentional out-of-sync position, this question can be answered and the strategy fine tuned over time. So monitoring some out-of-sync positions can assist in strategy development, although that's not the primary goal. Not loosing money unnecessarily is the primary goal. I'm sure both you and Fidelity agree with that.
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).