Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/theonetrade/uzse-backtest-app/llms.txt

Use this file to discover all available pages before exploring further.

TradingView’s Pine Script ecosystem contains thousands of open-source technical analysis indicators built and maintained by the global trading community. The problem is that UZSE — like many regional emerging-market exchanges — is simply not listed on TradingView: no data feed, no charting, no indicators. The UZSE Backtest App bridges this gap by executing Pine Script v6 indicators locally against candle data stored in MongoDB, giving you the full analytical power of the Pine Script library on a market that TradingView has never seen.

Why Pine Script on UZSE?

Many frontier and emerging-market exchanges — including MSE (Mongolia), UZSE (Uzbekistan), DSE (Dhaka), GSE (Ghana), and others — have no presence on TradingView. Their official websites typically expose only paginated raw trade tables, with no minute-level timestamps and no charting. By scraping those trades, building OHLCV candles, and feeding them into the backtest-kit editor, you can apply any Pine Script indicator to these markets as if they were listed on a major exchange.

Pine Script Execution Engine

The @backtest-kit/pinets package (v10.2.0+) provides a TypeScript-native Pine Script v6 execution runtime. It is loaded automatically when the editor starts — no separate compilation step is required. You can overlay indicators on the chart directly from the editor UI by loading any .pine file from disk.
UZSE market characteristics directly affect indicator behaviour. Single-price auction days produce a single candle with high volume surrounded by many zero-volume flat candles. Multi-day trading halts create extended flat regions. Indicators that rely on recent volume (such as the DeltaPulse Wave) will produce neutral readings across those gaps and spike sharply when trading resumes. Treat divergence signals that occur immediately after a halt with extra caution.

Bundled Indicator: DeltaPulse Wave

The project ships with math/deltapulse_wave.pine — the DeltaPulse Wave [ChartPrime] oscillator. It is a practical first indicator to load because it relies on volume rather than just price, making its behaviour on low-liquidity UZSE securities especially informative.

What It Does

The DeltaPulse Wave computes a Relative Delta Strength (RDS) oscillator by comparing EMA-smoothed buy volume against EMA-smoothed sell volume, both normalised to total volume, and scaling the result to a ±100 range. A second EMA smoothing pass produces the final wave line.
  • Positive wave values indicate that buy-side volume dominates — bullish pressure.
  • Negative wave values indicate that sell-side volume dominates — bearish pressure.
  • The oscillator also detects divergences between price action and the wave: a bearish divergence forms when price makes a higher high while the wave makes a lower high; a bullish divergence forms when price makes a lower low while the wave makes a higher low.
  • An on-chart dashboard shows the current wave value, trend direction, and last detected divergence type.

Key Calculation

//@version=6
indicator("DeltaPulse Wave [ChartPrime]", "DeltaPulse Osc [ChartPrime]", overlay = false, precision = 2)

float buyVol      = close > open ? volume : 0.0
float sellVol     = close < open ? volume : 0.0
float smoothedBuy  = ta.ema(buyVol, waveLen)
float smoothedSell = ta.ema(sellVol, waveLen)
float smoothedTot  = ta.ema(volume > 0 ? volume : 1, waveLen)

float rdsRaw    = (smoothedBuy - smoothedSell) / (smoothedTot > 0 ? smoothedTot : 1) * 100
float deltaWave = ta.ema(rdsRaw, smoothLen)
Candles where close > open contribute their full volume to buyVol; candles where close < open contribute to sellVol. The ratio (smoothedBuy - smoothedSell) / smoothedTot is then scaled to ±100 and smoothed once more to produce deltaWave.

Divergence Detection

bool isWaveHigh = deltaWave < deltaWave[1] and deltaWave[1] > deltaWave[2] and deltaWave[1] > (obThreshold * 0.2)
bool isWaveLow  = deltaWave > deltaWave[1] and deltaWave[1] < deltaWave[2] and deltaWave[1] < (osThreshold * 0.2)
Local wave peaks and troughs are compared against corresponding price highs and lows. A minimum bar gap (minGap, default 5) is required between two peaks or troughs before a divergence is confirmed, reducing noise on sparse UZSE data.

Input Parameters

waveLen
int
default:"20"
Wave Lookback — the EMA period used to smooth buy volume, sell volume, and total volume before computing the RDS ratio. Minimum value is 5. Increase this on low-liquidity symbols to reduce noise.
smoothLen
int
default:"5"
Smoothing — the second EMA pass applied to the raw RDS value to produce the final deltaWave line. Minimum value is 1.
obThreshold
float
default:"25.0"
Upper Threshold (OB) — the overbought level drawn as a reference line on the oscillator pane. Minimum value is 1.0.
osThreshold
float
default:"-25.0"
Lower Threshold (OS) — the oversold level drawn as a reference line on the oscillator pane. Maximum value is -1.0.
minGap
int
default:"5"
Min Divergence Gap — the minimum number of bars required between two wave peaks or troughs before a divergence signal is confirmed. Minimum value is 2.
showLines
bool
default:"true"
Show Divergence Lines — when enabled, draws connecting lines on both the oscillator pane and the main price chart between the two pivot points that form each confirmed divergence.

Dashboard

When showDash is enabled (default true), the indicator renders a small table in one corner of the chart (configurable via dashPos and dashSize) showing a header row and three data rows:
RowDescription
HeaderColumn labels: "DeltaPulse" and "Value"
WaveThe current numeric value of deltaWave, colour-coded bullish or bearish
Trend"Bullish" when deltaWave > 0, "Bearish" when deltaWave < 0
Last DivThe most recently detected divergence type: "Bullish", "Bearish", or "None"

Adding Custom Indicators

1

Write or download a Pine Script v6 indicator

Create a .pine file or copy one from TradingView’s public library. Ensure the script declares //@version=6 at the top. Pine Script v5 scripts may require minor syntax updates.
2

Place the file in your project directory

Drop the .pine file anywhere inside the project folder — for example, math/my_indicator.pine. The editor file picker scans the project directory recursively.
3

Load it through the editor UI

Open the editor (npm start), navigate to the indicator panel, and select your .pine file from the file browser. The @backtest-kit/pinets runtime compiles and executes it against the currently displayed candle data.
Start with the bundled math/deltapulse_wave.pine as a reference template. It demonstrates the full range of Pine Script v6 features supported by @backtest-kit/pinets: EMA calculations, divergence state tracking with var variables, plotshape, fill, barcolor, and dashboard table rendering.

Visual Editor

Learn how to start the backtest-kit editor and configure the MongoDB connection.

Exchange Module

Understand how MongoDB candle data is exposed to the editor via addExchangeSchema.

Build Candles

Generate the OHLCV candle data that Pine Script indicators are applied to.

Timeframes Reference

See all supported candlestick intervals from 1m to 1d.

Build docs developers (and LLMs) love