Number of markets in portfolio backtesting
Author: kkrisz
Creation Date: 5/7/2013 4:55 PM
profile picture

kkrisz

#1
Hi,
When I run my strategy on a DataSet (and not on an individual equity) can I control the number of markets to trade simultaneously? My real life strategy has some limitation on the number of equities to trade in the same time, and I would like to bring this logic into backtesting.
profile picture

Eugene

#2
Sure. For example, there are PosSizers like Position Options from MS123 PosSizer Library that can help limit the number of simutaneous positions, entries per day, etc.

Sounds like a combination of "Max open positions" and "Max open per day" should do the trick for you. Be sure to click these button labels to activate them: just typing in a number in the input box isn't enough.
profile picture

kkrisz

#3
Thank you Eugene. I had a look at the mentioned position sizer. It is really powerful. Unfortunately my system requires very specific position sizer logic therefore developing my own position sizer DLL is not avoidable.

I already made a working prototype of a possizer DLL based on the available documentation but there is one thing I couldn't solve yet:

how can the position sizer see the open positions of the portfolio?

profile picture

Eugene

#4
Krisztian, the open positions at any given bar are returned by a call to...

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

kkrisz

#5
Thanks again Eugene, it works like a charm. My probably last question in this topic is about using Data Series in position sizers:

Can I have access to the the dataseries objects of the strategy from the position sizer or can I establish on there? I need daily ATR value for the position size calculation...
profile picture

Eugene

#6
You can have it both in PosSizers:

1. have access to DataSeries (meaning: instantiating indicators defined in indicator libraries e.g. SMA)
2. pass on a DataSeries (or value, or any other custom Object) from a Strategy to the PosSizer

With ATR, you can simply reference WealthLab.Indicators.dll in your PosSizer solution, add a "using" directive (using WealthLab.Indicators) and then call the ATR DataSeries to determine the daily ATR value. It's really not different from how you're using ATR in a WealthScript Strategy.

For more information on PosSizer development, please refer to the PosSizer API guide (PDF).
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).