Sales of assets in fully invested portfolio delays new buys

Questions about MultiCharts .NET and user contributed studies.
SysInv
Posts: 28
Joined: 25 Nov 2012
Has thanked: 1 time
Been thanked: 1 time

Sales of assets in fully invested portfolio delays new buys

Postby SysInv » 08 Oct 2014

It's possible there's a quick workaround for this issue that I have missed, but I believe I have a problem with insufficient funds due to the way the portfolio tester is constructed:

Consider a fully invested portfolio in two assets. At a specific date I want to sell one asset and buy a new one, for a total that equals (or is less) than the asset sold. This shouldn't be a problem - in MC the asset is sold and a new is bought at the same time, while in real life one asset would be sold first followed by an immediate purchase of the new asset.

Running the portfolio backtester however, the puchase order gets declined because of this. I can see any order feedback that says just this, but I've verified that:
- The purchase order is properly sent
- After the sale sufficient funds are available for the purchase
- The correct order types are used

The purchase order just doesn't go through, which I can verify with checking the position objects and also Portfolio.InvestedCapital. On the bar after however the order will go through. If I decrease the investment to always be 50% of available equity instead, meaning that it will always be sufficient funds available to make another purchase even without selling an asset, then the purchase order goes through properly.

This can be considered as a simple asset rotational strategy - What would be the workaround for this?

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

Re: Sales of assets in fully invested portfolio delays new b

Postby Henry MultiСharts » 09 Oct 2014

Hello SysInv,

This behavior is correct. On the first bar you sell, on the next bar strategy acknowledges that it now has sufficient funds to do the buy and it generates it. There is no way to do both actions on the same bar/calculation. The workaround is to increase the capital or invest less capital into portfolio at once.


Return to “MultiCharts .NET”