Position count in a Multi-Symbol Backtest
Author: robinkno
Creation Date: 2/3/2019 5:51 PM
profile picture

robinkno

#1
Hi Eugene

I am trying to use a portfolio position count in a DataSeries using the following code:

CODE:
Please log in to see this code.


I cannot get around WL running on each Symbol and giving me the Symbol activeposition count as opposed to the portfolio active position count.

A laborious workaround that works is to use the following code to print to file and then export to a spreadsheet where I can manipulate to create portfolio active position count by bar.

CODE:
Please log in to see this code.


I'd very much appreciate if you can give me corrections to my code.
Thanks
Robin.
profile picture

Eugene

#2
Hi Robin,

Why are you trying to put a portfolio Position count in a DataSeries i.e. what's the purpose?
profile picture

robinkno

#3
Hi Eugene

I want to use it like a custom sentiment indicator
profile picture

Eugene

#4
Thanks for the clarification. The thing is, WealthScript was not designed with this in mind i.e. giving you the portfolio active position count. To achieve this you'd have to rewrite your entire Strategy code to run in Single Symbol mode so that it loops through DataSetSymbols and operates across the portfolio. Here's a good example: Limit Monthly Drawdown / Portfolio Equity Tracker, posts #12 and #15.
profile picture

robinkno

#5
Thanks Eugene
Got it!
profile picture

Eugene

#6
You're welcome.
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).