Position sizing
Author: IlyaIlya
Creation Date: 3/9/2009 3:53 PM
profile picture

IlyaIlya

#1
Dear collegues,

I don't have information about possibility of manual position management in WL 5.1/5.3. In earlier versions I used SetShareSize function. Is there analogous function in WL 5.1/5.3?
profile picture

Cone

#2
Not yet, but there will be in 5.4.
profile picture

IlyaIlya

#3
Thank you for your reply. And do you know when 5.4 version will be released?
profile picture

Cone

#4
I don't, but sometime after June probably.
profile picture

ss161

#5
can you suggest a work-around for this until position sizing comes in directly --

i have a script that trades two stocks based on a simple formula: y = a + bx (actually, y - bx = a). every time i buy symbol y i need to sell short b shares of x. how can i get the system to generate the correct number of shares of symbol x?

ideally, without using Microsoft Excel.
profile picture

Cone

#6
The work around would be to use Version 4.
profile picture

IlyaIlya

#7
The problem is not in generating trade with sertain amount of shared but in calculation of this amount. You cannot get information about current equity and cash in script. I hope in 5.4 version it will be possible
profile picture

Eugene

#8
QUOTE:
You cannot get information about current equity and cash in script.

You can in theory - albeit with a number of unsolved issues in reality. See Interacting Dynamically with Portfolio Level Equity in our WL5 Wiki.
profile picture

IlyaIlya

#9
There is another more clear way for equity calculation. We can emulate account functionality in the script. For this we need to create wrappers for functions ByAtClose, CoverAtClose etc and recalculate equity after each trade by ourselves.
profile picture

Eugene

#10
I don't think so. In portfolio simulation mode, all trades are pre-executed using 1 share per position - so the Shares property will always return 1 while the Strategy is executing. Position sizing is applied after the fact.
profile picture

IlyaIlya

#11
You are right. But at one bar you can do several trades with one share each. By this way we can emulate multishares trades.
profile picture

Eugene

#12
Do you want to put WL5 to its knees by executing 100,000 trades on some bar to emulate a $100,000 position size? ;) No, this is not the way to go. WL5 works differently in this regard - so I would wait for 5.4 to bring the native support for sizing in Strategies.
profile picture

IlyaIlya

#13
You always can reduce starting capital without a big influence on strategy accuracy
profile picture

IlyaIlya

#14
I tried to write class Account for the futures mode that I mentioned before. It works for one instrument in raw profit mode and allow to obtain equity information inside the script and do multishared trades.


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

Eugene

#15
Nice effort.
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).