Version: 1.0.1
Chart Transforms & Fundamentals
BacktestX allows you to transform raw price data into smoothed alternative charting styles like Heikin Ashi and provides built-in API mocks for fundamental requests.
Heikin Ashi Transformation
The ctx.ticker.heikinashi(barsArray) method takes a standard array of OHLC objects and mathematically converts the entire dataset into Heikin Ashi candles.
// Transform standard bars to Heikin Ashi
const haBars = ctx.ticker.heikinashi(ctx.bars);
// Extract the smoothed closes to use in moving averages
const haCloses = haBars.map(b => b.close);
const haSma = ctx.ta.sma(haCloses, 20);
ctx.plot(haSma, { color: '#2962ff' });
Fundamental & Economic Mock Data
If you are pasting a complex Pine Script that relies on external fundamental earnings reports or macroeconomic data (like US GDP), the engine provides mock generators to ensure your code compiles and runs successfully during backtesting.
ctx.request.financial(symbol, metric, period): Returns a static array of mock data.ctx.request.economic(country, metric): Returns a static array of mock data.