The custom symbol API enables you to create and manage your own symbols in cTrader. These symbols can represent synthetic assets, external datasets, derived metrics or completely offline instruments. Each custom symbol can be defined using one or two assets and supports full integration with timeframes, charting, indicators, backtesting and real-time updates.
Key types and methods for custom symbols include:
CustomSymbols.Add(name, baseSymbol) or CustomSymbols.Add(name, baseAsset, quoteAsset) to create a new custom symbol.
CustomSymbol.BarsNeeded to supply OHLC data for the symbol on demand.
CustomSymbol.UpdateQuote(bid, ask) to feed live prices to the symbol.
CustomBars.AppendBars(), UpdateLastBar() and PrependBars() to manage bar data dynamically. Each CustomBar stores Time, Open, High, Low, Close and Volume.
Additionally, developers can define swap rates, commissions, leverage tiers, sentiment, futures settings and even market hours or holidays for custom symbols. Once created, custom symbols are fully interactive and can be viewed in charts or used programmatically in cBots, indicators and plugins.
Tip
Use custom symbols to visualise external data, simulate spreads or correlations, test strategies on proprietary datasets or combine multiple assets into synthetic instruments.
Custom symbol API objects can be used to do the following:
Feature or operation
Examples
Simulating synthetic assets
Build a spread symbol (e.g. UKOIL - USOIL) Create equity or currency baskets
Visualising offline datasets
Load CSV data for markets Plot historical interest rates or economic indices
Live charting from APIs
Feed external real-time prices Stream calculated fair value or risk metrics
Strategy testing on custom data
Backtest on fundamental or alt datasets Simulate legacy market environments
Generating synthetic quotes
Derive custom prices from existing symbols Inject quotes into custom instruments
Display macroeconomic indicators such as CPI, unemployment rate or GDP as synthetic OHLC bars. This approach enables strategy overlay, divergence analysis, and historical pattern tracking using structured economic data.
Combine multiple equities into a custom symbol that reflects a weighted portfolio. This setup allows you to track performance, apply indicators and backtest strategies on a synthetic equity index built from selected components.
Consider creating a custom symbol that represents the price spread between gold and silver (XAUUSD - XAGUSD). This custom symbol may help with spread trading strategies, divergence detection and intermarket analysis on precious metals.
By analysing the difference in price movements between gold and silver, traders can identify relative strength, potential arbitrage opportunities or hedge one position against the other.
Create a real-time synthetic instrument by subtracting prices of two forex pairs. This custom symbol enables charting and trading of the spread directly, supporting mean-reversion strategies, visual tracking and spread-based hedging.
1 2 3 4 5 6 7 8 910111213141516171819202122
privateCustomSymbol_eurGbpSpread;privateSymbol_eurusd,_gbpusd;protectedoverridevoidOnStart(){_eurusd=Symbols.GetSymbol("EURUSD");_gbpusd=Symbols.GetSymbol("GBPUSD");_eurGbpSpread=CustomSymbols.Add("EUR‑GBP Spread",_eurusd.QuoteAsset,// both legs already trade in USD_eurusd.QuoteAsset);// propagate tick updates_eurusd.Tick+=OnLegTick;_gbpusd.Tick+=OnLegTick;}privatevoidOnLegTick(SymbolTickEventArgs_){varmid=_eurusd.Bid-_gbpusd.Bid;// naïve spread_eurGbpSpread.UpdateQuote(mid,mid+0.00001);// 0.1 pip synthetic spread}