Money management in Portfolio Backtester

Questions about MultiCharts and user contributed studies.
Xyzzy
Posts: 162
Joined: 19 Mar 2011
Has thanked: 43 times
Been thanked: 79 times

Money management in Portfolio Backtester

Postby Xyzzy » 09 Apr 2011

I'm having some difficulty understanding the various "Portfolio Settings" options in the Portfolio Backtester. The help files don't seem to shed much light. I'm particularly confused about the "Margin per Contract" and "Potential Loss per Contract" settings. Could someone please explain what these various settings do?

I have a problem that might be related: I created a sample portfolio with 60 symbols with daily bars, and some simple moving average crossover strategies. I then created some parameters with a $100,000 starting portfolio and a "dollars per trade" value of $25,000.

When I changed the "Max Potential Loss" setting to "100%," the strategy would first place four large trades for about $25,000 each that maxed out the available funds. However, the strategy then started placing smaller trades for just a few contracts (i.e., $100 or $200 each). I've attached a screenshot. Is this the expected behavior, or is it a bug?

I would prefer for the strategies to make a binary decision: If the available cash is less than the "dollars per trade" value, don't place any trades. I.e., either place large trades, like the $25,000 positions above, or don't place any trades at all. I don't want it to make nickle-and-dime trades when most of the cash is tied up in other positions. Can this result be accomplished through the Portfolio Backtester, or do I need to create some custom money-management logic within the individual strategies?
Attachments
Portfolio Backtester.png
Screenshot of portfolio backtester
(535.7 KiB) Downloaded 903 times

Xyzzy
Posts: 162
Joined: 19 Mar 2011
Has thanked: 43 times
Been thanked: 79 times

Re: Money management in Portfolio Backtester

Postby Xyzzy » 09 Apr 2011

I'm getting a bug when I tried to download my screenshot. Here it is in a TIFF format.
Attachments
Portfolio Backtester.tif
(765.06 KiB) Downloaded 896 times

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 302 times

Re: Money management in Portfolio Backtester

Postby Stan Bokov » 12 Apr 2011

Portfolio_backester_seetings.png
(80.03 KiB) Downloaded 900 times
Thank you for your question. Portfolio Backtester is an area where Help files and videos can be significantly improved. We realize that, and we are working on improving this.

In the portfolio, the amount of money you have at any point after you start trading is calculated according to this formula: Portfolio_Equity = InitialCapital + Portfolio_NetProfit + Portfolio_OpenPositionProfit – TotalPotentialRiskCapital;

TotalPotentialRisk Capital is TotalPotentialRiskCapital = ∑ PotentialRiskCapitalForSymbol for each symbol. This is the amount that is 'frozen', which you can't reinvest, since it's potentially lost.

Amount of money that you currently have available (EntryAmount) is calculates like this: EntryAmount = Portfolio_Equity * PercentOfEquity / 100; where PercentOfEquity – is the number you entered in Portfolio options «Percent of Equity» in percent.

You start with InitialCapital (let's say 100,000) and then you buy your first 4 for 25,000 each. But then the other factors, like OpenPositionProfit kick in, and that money is considered available for reinvesting. Therefore, the Portfolio Backtester has a little more money and tries to purchase another 25,000 (if your conditions are met). However it gets shot down, since it doesn't have enough money to buy the whole $25,000 and instead it gets a partial fill.

Xyzzy
Posts: 162
Joined: 19 Mar 2011
Has thanked: 43 times
Been thanked: 79 times

Re: Money management in Portfolio Backtester

Postby Xyzzy » 12 Apr 2011

Thank you very much Stan. I appreciate it.

Is there any way -- either automatically in the Portfolio Backtester, or manually through some money-management EL code in the strategy -- to prevent partial fills? I would like to make a binary decision -- don't make a purchase unless there's enough available cash for a complete fill.

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 302 times

Re: Money management in Portfolio Backtester

Postby Stan Bokov » 14 Apr 2011

Currently there is no automated way of limiting partial fills. You can try to limit the trade size manually in your code by using keywords PortfolioInvestedCapital and InitialCapital. However, based on my tests, there is still a "trail" of small partial fills which follow your big ones with the code that we could come up with.

Xyzzy
Posts: 162
Joined: 19 Mar 2011
Has thanked: 43 times
Been thanked: 79 times

Re: Money management in Portfolio Backtester

Postby Xyzzy » 14 Apr 2011

Thanks Stan. I really appreciate the information. I'll submit a feature request for this capability in your project management forum.


Return to “MultiCharts”