Does anyone know a way to have Multichart's portfolio backtester use a flat percentage of TOTAL portfolio value. Because although that is roughly the language in the setup menu it actually does a really strange thing when you look at the trades it places:
If you were to say 95% of equity per trade, then, on a $100,000 starting amount, it would allocate 95k to the first trade at the second trade it would allocate 95% of the remaining 5k, and then of the 0.25k remaining it would allocate 95% of that to the next trade and so on. Why on earth would anyone want to do that... ?
In the example given I would like it to make the 95k trade and then STOP because there is not enough capital remaining to make another (in this case) 95% of capital trade. (this example makes a lot more sense when we are talking about 2% per trade or something.
Anyway if anyone has any work arounds to make it calculate based on total portfolio equity as opposed the unallocated cash that would be great thanks!
personally I have found it works best for me to control those things directly from the code. I.e. you compute the available equity, the position size and track the remaining capital. This surely is a bit of work, but not only does this offer you more flexibility, the code will also do exactly what you want.
What would your calculation look like to find total portfolio value at any given time?
Portfolio Value = Initial Capital + Gross Profit + Gross Loss + OpenPosition Profit
? Would that be the right number?
And then to find available capital it would be Portfolio Value - (Invested Capital + Open Position Profit)?
Does that look right?
I would like to take the full portfolio value at a point in time and then subtract the invested capital to know how much remaining buying power is available and then use a percentage of total portfolio value to determine the size of new trades (which should execute at that size until a full trade of that size can no longer be made due to lack of buying power).
these are not the correct reserved words, but in general your formulas can work like this.
Instead of Gross Profit + GrossLoss you can use the NetProfit.
If you want to include the open position profit into the calculations of the available capital depends on the risk you are willing to take.