Exciting Update: Version 1.0.1 is now available, introducing high-performance technical indicators and custom drawing tools. Read more
Version: 1.0.0

Custom symbol details

The CustomSymbolDetails module provides a developer-configurable symbol resolver for BacktestX Chart. It dynamically resolves symbol parameters such as trading sessions, decimal/pricescale precision, and timezones based on the symbol name.

Symbol Resolver API

The symbol resolver is exposed via the global window.ChartingAPI.resolveCustomSymbol function. It resolves symbol configurations asynchronously and triggers the provided callback:

window.ChartingAPI.resolveCustomSymbol = function(
  symbolName,
  onSymbolResolvedCallback,
  onResolveErrorCallback
) {
  const tokenSymbol = symbolName || "BTCUSD";
  const logicSymbol = tokenSymbol.toUpperCase().replace("_REPLAY", "");

  // ... resolution logic ...

  setTimeout(() => {
    onSymbolResolvedCallback(symbolInfo);
  }, 0);
};

Developer Customization Area

Developers can customize the session, type, and price scale of symbols by editing the custom-symbol-details.js file. By default, the resolver handles different categories of crypto symbols:

  • CRYPTO_2_DECIMALS: Symbols that resolve to 2 decimals (e.g., BTCUSD, pricescale = 100).
  • CRYPTO_4_DECIMALS: Symbols that resolve to 4 decimals (e.g., pricescale = 10000).
  • Fallback default: Fallback parameters for any other symbols.
const CRYPTO_2_DECIMALS = ["BTCUSD"];

let type = "crypto";
let session = "24x7";
let pricescale = 100; // Default to 2 decimals

if (CRYPTO_2_DECIMALS.includes(logicSymbol)) {
  type = "crypto";
  session = "24x7";
  pricescale = 100;
} else {
  type = "crypto";
  session = "24x7";
  pricescale = 100;
}

Symbol Info Schema

The resolved symbolInfo object contains the following properties that define how the chart behaves:

Property Type Description
ticker / name string The symbol identifier (e.g. BTCUSD).
description string A friendly description of the symbol.
type string Symbol type (e.g. crypto, forex, stock).
session string Trading session hours (e.g. 24x7).
pricescale number Decimal precision multiplier (100 = 2 decimals, 10000 = 4 decimals).
supported_resolutions string[] List of timeframe resolutions supported by this symbol.