Portfolio Backtester does not manage a Portfolio

Questions about MultiCharts and user contributed studies.
vicdech
Posts: 3
Joined: 26 Jul 2011

Portfolio Backtester does not manage a Portfolio

Postby vicdech » 04 Nov 2011

I have a question/concern about the Portfolio Backtester

Despite the signal stating "if marketposition=0 then…." , the Backtester allows multiple open positions to occur. The marketposition statement seems to only hold true for the same stock, but if backtesting on a basket of stocks it allows a number to be open at the same time should conditions be met.

To me this does not help with portfolio management at all.
It simply saves time testing the signal against many stocks or commodities, doing them at the sime time, rather than one after the other.
It does not help answer the question,....... If I had 100k to invest, what would the outcome be after x no. of trades or y amount of time , knowing that the maximum I could trade was starting with a total of 100k spread across all open positions, not just each different one.
Ideally the Portfolio Backtester would then use the new account size (Total Acct = Acct + netprofit) represented by the sum of the profits and losses to-date, but sadly it only seems to do this in respect of each individual stock.

Hence, in my opinion the portfolio backtester should be renamed more simply as Backtester.

I would love to see true portfolio testing available in the next enhancement.
BTW, I have looked up a number of threads about changing Max Potential Loss to 100% and a few other tweaks in Portfolio Settings, but the basic outcome is the same ……..it does not appear to limit trades to a COMBINED value as set in the signal or portfolio settings.

Please tell me if I have overlooked something (Backtester documentation currently = 0)
else
MC Please provide the enhancement.

In my opinion, and I have met some truly awesome traders, money management and portfolio management is where the real dollars are made. If Multicharts can do something spectacular with that I believe many more traders/investors would be interested (appealing to MC's commercial interests here).

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Portfolio Backtester does not manage a Portfolio

Postby JoshM » 05 Nov 2011

Despite the signal stating "if marketposition=0 then…." , the Backtester allows multiple open positions to occur. The marketposition statement seems to only hold true for the same stock, but if backtesting on a basket of stocks it allows a number to be open at the same time should conditions be met.
Have you tried the Portfolio_CurrentEntries keyword? (If that keyword would equal zero, there is no MarketPosition in the portfolio)
Portfolio_CurrentEntries

Returns a numerical value, indicating the combined number of entries currently open within a portfolio.
It does not help answer the question,....... If I had 100k to invest, what would the outcome be after x no. of trades or y amount of time , knowing that the maximum I could trade was starting with a total of 100k spread across all open positions, not just each different one.
Ideally the Portfolio Backtester would then use the new account size (Total Acct = Acct + netprofit) represented by the sum of the profits and losses to-date, but sadly it only seems to do this in respect of each individual stock.
Do you mean the Portfolio Backtester itself or your signal backtested by the Portfolio Backtester? In the signal, you can use one of the Portfolio reserved words for getting this data:

Image

Found in the PowerLanguage Editor -> Dictionary Field. (If you can't see that, check the View -> Navigator Bar setting)

Regards,
Josh
Attachments
portfolioReservedWords.PNG
(25.25 KiB) Downloaded 608 times

vicdech
Posts: 3
Joined: 26 Jul 2011

Re: Portfolio Backtester does not manage a Portfolio

Postby vicdech » 05 Nov 2011

Thanks JoshM,

I was hopeful that Portfolio_CurrentEntries =0 would do the trick, but it didn't

As chance would have it, there were a few occasions where there were no open positions at a all but the signal entry conditions were met at exactly the same time in 2 or 3 different stocks.
So Backtester accepted the orders with the result that in the real world I would have been trading a total of 300k open orders, instead of 100k.

I looked at the possibility of using PortfolioEntriesPriority and this was promising when combined with a Max Potential Loss setting of 100% in portfolio settings…..
but
one of the priory settings I tried still allowed total entry in excess of 100k because order 1 totalled 34k in size while order 2 totalled 100k. Order 2 needs to be limited down to 66k, but I see no way of doing this when the orders are generated at exactly the same time.

Portfolio_SetMaxPotentialLossPerContract didn't help either.

BTW In case you are wondering why the different order size............
the signal determines the stop size in points (variable but say 10c), contract numbers are determined by the predetermined potential loss (say $250, so contracts=250/stop size, in this case 2500), order size = close x contract size (so in a $13.50 stock, order size = $34,000 while the same stop size in a $40 stock would generate order size of 100k).

Anyway, lets say that potential order size for 3 stocks with a valid entry signal are $34k, 50k and 40k, when all current positions=0, I don't see how Backtester can limit the orders to the real world total of 100k

Any further ideas would be appreciated.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Portfolio Backtester does not manage a Portfolio

Postby JoshM » 06 Nov 2011

(..)
As chance would have it, there were a few occasions where there were no open positions at a all but the signal entry conditions were met at exactly the same time in 2 or 3 different stocks.
So Backtester accepted the orders with the result that in the real world I would have been trading a total of 300k open orders, instead of 100k.
According to the manual, that should not happen:
During backtesting, a single bar of each symbol’s data series is evaluated by the strategy’s signal scripts, starting with the first (oldest) bar. The series’ bars are evaluated in the order that the symbols appear in the symbols table of the Portfolio Backtester. Based on evaluation of each series’ bar, a set of one or more orders may be generated by the scripts for each of the symbols. Order sets are generated in the same sequence as the series’ bars are evaluated.

(...)

At the risk control stage, the sequence of order sets is treated as one long sequence of orders. The orders are executed one-by-one from the beginning of the sequence, until all orders are executed, or until the risk control limits defined in Portfolio Settings of the Portfolio Backtester prevent the execution of remaining orders. Any remaining orders that could not be executed are discarded.
See page 235 of the MultiCharts manual (found here).

Can you provide a code example of your strategy and an overview of the Portfolio Backtester settings?

Regards,
Josh

vicdech
Posts: 3
Joined: 26 Jul 2011

Re: Portfolio Backtester does not manage a Portfolio

Postby vicdech » 06 Nov 2011

It would seem that it should not happen, but it did/does (assuming I have not made an error)
I'm busy for the next few days & in the Oz time zone.
I'll try & post something then.

Cheers

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Portfolio Backtester does not manage a Portfolio

Postby Henry MultiСharts » 07 Nov 2011

Initial Portfolio Capital and Max Potential loss should have limited the orders.
Please provide an example of your script, screenshots of all Portfolio Backtester settings and the Bactesting report for futher analysis.


Return to “MultiCharts”