Position Sizing based on the number of alerts on a given bar
Author: DaveAronow
Creation Date: 1/12/2010 7:19 PM
profile picture

DaveAronow

#1
I remember this being an issue in WL4 solved with I believe global variables of some kind. How is this solved in WL5 -- is there some built-in way to do via a PosSizer or do you need an external hack of some kind?

For example say you're running a standard dip buyer which generates 10-50 alerts (limit buy orders) every day. If there are more than 25 alerts you want to allocate 10% of available cash on that bar to each alert (knowing many will not hit). If there are fewer than 25 alerts you want to allocate 15% of available cash to each alert. What would be the "best" (easiest) way to do this?
profile picture

DaveAronow

#2
I discovered (OK just tried it) and I see that a static variable in the strategy class can be used for this.

CODE:
Please log in to see this code.


If you run the above on the Dow 30 you get each symbol with a higher value. So a dataseries could be used to hold the count for each bar. Then the question is how to pass that dataseries into the PosSizer's SizePosition method -- maybe via the Bars object?
profile picture

Eugene

#3
"Passing data via Global variables to Simuscripts", as well as "Optimizing position sizing" - we have to forget about these WL4 techniques in WL5 as they're no longer here.

By the way, PosSizers do know about the potential Positions on the bar on which the PosSizer is called - like in V4, this is called CandidateCount. We're currently discussing it here: CandidateCount
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).