MS123 PosSizer Library by Eugene

profile picture

Panache

#1
Position Options is not sizing Alerts properly. It is generating more Alerts (with a non-zero size) than are allowed by the configuration.

I am running the following code with Max open positions set to 10 on a DataSet containing 6 symbols (including A)

CODE:
Please log in to see this code.

Position Options is showing Alerts with sizes greater than 0 for all 6 symbols, even though this would exceed the Max open positions. I assume this is due to Open Issue 62853.

I get the same result setting Max open in symbol to 1. (Open Issue 68057). You've solved the latter problem in the One Trade Per Symbol PosSizer, which generates six Alerts, but only the Alert for A has a non-zero size.
profile picture

Eugene

#2
Actually, bug #62853 (In PosSizers, the Candidates list is empty for Alert sizing) doesn't have to do with this. Here, the option in question does not operate on the Candidates list.

The scenario you're questioning (i.e., a mix of existing positions and alerts) wasn't considered when designing the option. Being one of the first it was designed with backtesting in mind. Currently it acts simply, considering realized Positions only. If the number of active Positions is equal or greater to the cutoff threshold, new alerts are zero-sized. But if not yet, there is no limit to the number of Alerts.

Being able to take Alerts into the equation might be a potential feature enhancement. I'm putting this on the list of things to investigate in the forthcoming months.
profile picture

Panache

#3
Any chance you could change the Alerts functionality to only display Alerts with quantity greater than 0? I think any Alert with a quantity of 0 means it was rejected by the PosSizer, ie. Max Open Positions. It's not a fix for bug #62853, but it would be a good workaround.
profile picture

Eugene

#4
QUOTE:
Any chance you could change the Alerts functionality to only display Alerts with quantity greater than 0?

Sorry, changes to the Wealth-Lab client can only be approached by Fidelity.

P.S. Re: "Being able to take Alerts into the equation might be a potential feature enhancement.", I haven't investigated into this TODO (in post #2) yet but I may be able to do it later.
profile picture

Eugene

#5
I looked into it.

Re: Max positions per symbol. When sizing for Alerts, the currentPos object passed by WL to the PosSizer is null. Therefore, an Alert's Symbol property will be null as well. Since the symbol is not known to the PosSizer, "Max positions per symbol" cannot be fully compatible with alerting.

Re: Max open positions. In your test case the number of active positions is 5 so when you set "Max open pos." to 10 the condition is false for alerting. Formally the PosSizer works correctly even if it produces 6 (and much more) non-zero alerts. Unless bug #62853 is fixed and the Candidates list works again, the PosSizer probably cannot be made aware of potential candidates for sizing Alerts.

Fidelity's "One Trade Per Symbol" is different and I don't think its simple algorithm is "compatible" with PosSizer's complex logic.
profile picture

Eugene

#6
I just found an older backlog item of mine based on a ticket from 2015 where I had investigated this issue and came to the same conclusion ("Max open positions" filter is N/A to Alerts). Darn.
profile picture

Eugene

#7
UPDATE:
This bug will be fixed in WLD 6.9.24. No ETA at the moment as we're still trying to fix an issue with this build.
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).