Your interactive trading laboratory!
28 users online

Quantacula Help

C# API Reference
Development Blog
Indicator Spotlights

QCommunity Extensions
The open-source GitHub repository of source code for the QCommunity Extensions library. Contains indicators and other extensions submitted by the Quantacula Community. Look for QCommunity indicators when you create a Building Block model, mark the "QCommunity" library check box to expose them.

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.
Universe Reference
Published by Glitch on 12/3/2018

The Universe class represents a set of symbols and optional logic controlling the symbols. A Universe Provider Extension (which is an instance of the UniverseProviderBase class) delivers one or more Universe instances in its Universes property. If you are implementing a Universe Provider, you will need to either create instances of the Universe class for this method, or derive a new class from Universe that contains the functionality that you need.

Basic Properties

In a Universe Provider, you'd typically set these properties at the time the Universe is created in the Initialize method or possibly the Universes property.


public string Name

Assign a value to the Name property to give each Universe you supply a unique name.


public List<string> Symbols

Populate this list with the symbols that your Universe contains.


public Bitmap Glyph

Assign a 24x24 bitmap here to represent the Universe's icon in Quantacula Studio.


public string BenchmarkSymbol

You can optionally assign a default benchmark symbol to use when backtesting with this Universe.


public bool ReadOnlySymbols

Set this property to true to make the symbols read-only in Quantacula Studio.

Extended Functionality

Derive a new class from Universe to access this extended functionality.


public virtual List<string> TradableSymbols

By default this property returns the Symbols. You can override this to return a subset of Symbols. Perhaps your Universe contains old stocks that are no longer trading. This is a way to communicate which of your symbols are currently active.


public virtual bool ShouldReturnOwnData

Override this property and return true to indicate that this Universe should be responsible for returning its own historical data. If you do so, be sure to implement the GetHistory method below.


public virtual BarHistory GetHistory(string symbol, HistoryScale scale, DateTime startDate, DateTime endDate, int maxBars)

Implement this method if your Universe is responsible for returning its own historical data. This is a way to lock the data delivery to a Historical Data Source that you control, instead of letting Quantacula Studio use any available Data Source to return data for the symbols. See the corresponding entry in the DataLoaderBase class reference for a discussion of this method.


public virtual void PostDataLoad(BarHistory bh)

This method is called after Quantacula loads historical data for a symbol in your Universe. You are passed the historical BarHistory data in the bh parameter. The primary purpose of this method is to allow you to apply a date range to the historical data. This can be used, for example, to indicate the dates that it was part of a dynamic index. To do so, call the BarHistory AddExecutableRange method on the bh instance. AddExecutableRange takes two DateTime parameters that represent a start and end date. The Quantacula backtester will not allow any trades on the symbol that fall outside this date range. You can call AddExecutableRange multiple times if you need to define multiple ranges.