Your interactive trading laboratory!
8 users online

Quantacula Help

C# API Reference
Development Blog

The open-source GitHub repository of source code for the TASCExtensions Quantacula extension. Contains indicators and other extensions adapted from the Traders' Tips articles in Technical Analysis of Stocks & Commodities magazine.
The Ins and Outs of Portfolio Level Backtesting
Published by Q Glitch 20 days ago and Quantacula Studio make it easy to backtest a trading model on a portfolio of symbols. Here are some things to consider and try as you experiment with portfolio level backtesting.

The Equity Curve

The Equity Curve gives you a ton of information at a glance. Much of this is quantified into various performance metrics, but nothing beats looking at the Equity Curve and seeing at a gut level that this model has potential.

  • The darker green areas represent periods where you are in cash.

  • The lighter green areas show how much you are invested at any time.

Equity Curve

Position Sizing

The Position Sizing controls give you flexibility and have a huge impact on the model's performance. The Percent of Equity option here is the most commonly used. It gives each position an allocation of capital based on a percentage of the current simulated equity. As an experiment, run your model using Percent of Equity 5%, then 25%, and then 100% and watch the drastic changes in performance.

  • You should consider the number of symbols in the Universe being tested when picking a Position Size.

  • Higher Percent of Equity values will provide more exposure, but also more volatility in your returns.

Position Sizing

Equity Considerations

Consider this: you're backtesting on the Nasdaq 100 Universe of symbols, using a Position Size of 10% of Equity. What happens when you get more than 10 trade signals at one time? You run out of simulated equity, and some of the positions will simply not get filled by the backtester. These are called NSF Positions, and you can see if you have any in the Performance Report.

  • Use some Margin Factor to give your model more buying power to reduce NSF Positions.

  • If you have more Positions than available simulated equity, Quantacula determines which orders to fill randomly.

    • For this reason, performance results might change from run to run, all other things being equal.

    • For limit orders, Quantacula uses a Position priority that favors symbols that drop more at open, instead of random determination.

  • In C# Coded Models, you can specify a Position Priority by assigning a value to the TransactionWeight property of the Transaction class.

NSF Positions

Factoring in Trading Costs automatically deducts a simulated $4.95 commission per trade from your backtest results. In Quantacula Studio, you can control how much commission to apply. Quantacula Studio also lets you factor in margin interest and interest on cash in your simulations.

Your Universes

To get the most out of portfolio level backtesting, you'll need to create your own Universes of data that contain the symbols that you are interested in. This feature is part of the Web License, and of course is standard in Quantacula Studio. To acquire your Web License, or QStudio License, visit this page for details.