PosSizer: WealthScript Overide (SetShareSize) + limit the total amount of $ invested
Author: wl64bit
Creation Date: 3/30/2011 9:24 PM
profile picture

wl64bit

#1
Is there position sizer that allows to manage Portfolio with combination of WealthScript Overide (SetShareSize) and ability to limit the total amount of $ invested in the portfolio at any time.

For example:

Starting Capital 100K
Want the system to invest maximum 50K at any time, but the amount invested in each position will be managed from the script using (SetShareSize) function.
profile picture

Eugene

#2
Position Options allows to use WealthScript Override but doesn't limit the amount invested at any time currently.

Is limiting the total amount of invested money as a percentage of equity vs. $ OK with you? Would you agree with me that it's more universal? In this case, that would be a decent enhancement to the PosSizer.
profile picture

wl64bit

#3
I do not think limiting the total amount of invested money as a percentage of equity would be the same as limiting total $ invested. It because from the script we can control only the position size in $ but not in a % of the current equity. In order to be on the same scale, the limitations on equity should be in $ as well.
profile picture

Cone

#4
See the example I just posted here. When time permits, we'll get this in a KB Article.

The example doesn't actually use Equity, Cash, and Drawdown (they're just plotted at the end), but you can access their values on each bar (or previous bars).
profile picture

wl64bit

#5
Thank you Cone. It is a great option, but making such position sizer would make it much easier to work with. In addition, we could control position size in $ from the script, and indirectly, number of positions invested just by limiting the amount of $ invested in the equity. It would also make it easier to analyze the results such as DD in term of $ while knowing the maximum amount invested in $.
profile picture

Eugene

#6
OK I see your point wl64bit but it would be pretty specific to include in Position Options then.

Perhaps I might try expanding the "Portfolio Heat" PosSizer to introduce a fixed dollar limit, or maybe a custom PosSizer for you.
profile picture

Cone

#7
Okay, I didn't follow how you could use SetShareSize to limit the amount of dollars sized if you weren't aware of any of the Portfolio-level variables... but I understand how the sizer can do it much more easily. Sometimes I'm slow, but I eventually get there. :)
profile picture

wl64bit

#8
Thank you guys for a great job you do!
profile picture

Eugene

#9
wl64bit,

I thought of it and decided that your idea sounds pretty tailored to go to MS123 PosSizers, so a custom PosSizer built for you would be optimal. Please enter a new support ticket and when the DLL is ready, I'll attach it.
profile picture

abegy

#10
I'm interesting to have the same feature. Why you don't include this feature in the current PosSizer component ?
profile picture

Cone

#11
What do you mean by "the current PosSizer component"?
profile picture

Eugene

#12
For example, when trying to avoid including single-user solutions (specific and never requested before) in popular addins, overloading the interface with less used options, maintaining stability and compatibility (since PosSizers keep settings in config strings). Hope my answer clears the question.

Is your voice for the dollar-based or percentage-based measure?
profile picture

abegy

#13
If it's possible, I would like to have both (Dollar and percentage).
Thank you very much !
profile picture

Eugene

#14
In version 2011.06, I have implemented this feature in the revamped Position Options PosSizer. Both dollar- and percentage-based limits are supported.
profile picture

abegy

#15
Thank you very much !

Can I ask you an upgrade ?
I see that you can reject order if size > %...
But there is one missing option in my opinion : minimum size of an order in $ with the possibility to rejet if the size of the order is under or apply the minimum size instead of.
profile picture

Eugene

#16
I already revamped the dialog to fit the last request to the layout, so we might not have enough screen "real estate" for more options there (unless they are super useful).

So far I couldn't understand why would one want to override his position sizing as suggested. If the resulting size is not enough for one contract/share, a PosSizer will not help with that anyway. Otherwise why not bump up the amount/percentage allocated?
profile picture

abegy

#17
In Europe, there is a lot of stocks with small daily volume (around 10000€ / day).

For this type of stocks, I trade with a minimum amount and don't take into account average volume because it's not signifiant in this case.

It's that why It will be interested to add this option.
profile picture

Eugene

#18
OK if revamping the PosSizer's GUI once again succeeds, I'll try adding the requested option.
profile picture

Eugene

#19
The suggestion above by abegy has been fully implemented after redesigning the Position Options dialog.
profile picture

Eugene

#20
QUOTE:
But there is one missing option in my opinion : minimum size of an order in $ with the possibility to rejet if the size of the order is under or apply the minimum size instead of.

As streak turned my attention to this option in another thread, I looked at it closely and should say that the option "Reject if size < $" is acting like "Reject if size < Shares" rather than what's advertised. In upcoming version, I'll fix it so that the option will behave as per abegy's original request. Sorry for the inconvenience.
profile picture

Eugene

#21
This issue has been fixed in v.2012.06.
profile picture

wl64bit

#22
It looks like "Use SetShareSize" does not work properly while script uses "MarketPosition" function. I think the MarketPosition is always counted as zero shares even if there are open positions. On the other hand, BackTester works fine if we use "WealthScript Overide" option.
Is it possible to fix it?
profile picture

Eugene

#23
Please provide a brief and reproducible test case. This example will help: How to report a Problem?
profile picture

wl64bit

#24
CODE:
Please log in to see this code.



In the above case, using "WealthScript Overide" option, first position will be sized for $5000 but the following positions will be sized for less than $5000 while the first position is still open. But, if you chose "Use SetShareSize" in the position sizer, SizePos will always be $5000 for all the following positions even if there is at least one position open.
profile picture

Eugene

#25
In "Position Options", the "Use SetShareSize" option does not function when sizing Alerts at bar+1. Its usage is limited to backtest trades.

P.S. This PosSizer can't be affected by usage of MarketPosition in your script.