Backtesting or simulation is the process of simulating a quantitative investment or trading strategy with historical data in order to analyze the resulting portfolio.
There are mainly two kind of backtesting: basket backtesting and true portfolio backtesting.
In basket simulation, software simply performs iterative backtesting for each symbol in a list of assets.
True portfolio simulation in the other side considers the portfolio characteristics, like the cash balance, the holding positions, the margin requirements, the money management rules, and thus gives the most realistic trading results.
The simulation process is carried through by consistently applying a set of trading rules in order to replicate buy, sell, hold, short and cover decisions in a portfolio context.
A true portfolio simulation must translate these buy, sell... signals into orders (Market on open, Limit order...).
Before translating the signal into a trading order, the simulator must know exactly how much cash, number of positions... are available in the portfolio so it can create the order with the correct settings.
A limit order for instance, must provide the limit price, the number of shares to buy or short, the number of days or bars to keep the order before cancelling it…
In most advanced simulators, a trader must have full control over this process and must be given the ability to override any order using money management rules.
Besides, a trader should be able to create scale-in and scale-out order and thus accumulate or reduce its exposure to a particular stock, future…
Before sending any order, some other verifications must be done, for example:
Is there a restriction on buying or shorting the current symbol?
If the portfolio is currently short on the symbol and a buy signal occurs. In that particular case, the trader have to choose whether to reject the signal or reverse the position (cover the position and initiate a buy).
After sending the orders and depending on the trading system settings, the simulator have to check the orders against a set of filters, the orders must pass the tests so they can be filled.
Some of these filters include:
The volume on the trading date must be N times higher than the order volume, otherwise the order is not filled and it is carried on.
How old the trading order is? Any order has a lifespan and thus must be closed or transformed after a specific period.
Transformation must be done for example when initiating a limit order to sell a position. If the limit order is not executed after a specific period it can be transformed into a market order.
A true portfolio simulation must be able to give you a snapshot of the current portfolio condition and details at any moment, it should have the ability to display at anytime in the past divers statistics.
You must be able to pick a trading day, let us say for example the first day of July in 2002, then display what was the available cash, the equity value, the drawdown value, the number of positions, the holding positions, the pending orders, the details of each order... for that trading day.
For future trading, a true portfolio simulation must withdraw the margin deposit amount from the cash position, handle the lot size, and tick size.
Multi-assets simulators can also handle positions from different assets; commodities, options, stocks, currencies...
In summary, a true portfolio simulation must be able to replicate a true portfolio and give you the most realist trading results so that you can be confident when you start implementing your trading strategy in real-life.
QuantShare software simulator performs a true portfolio simulation.
QuantShare can do everything described above and much more.