Documentation Index
Fetch the complete documentation index at: https://docs.darvas.app/llms.txt
Use this file to discover all available pages before exploring further.
Why performance matters
The indicator runtime evaluates every historical bar before rendering. On a 100K-bar window, a 50ms-per-bar budget would theoretically allow 5000 seconds - but the total run budget is 10s. At 100K bars, you have ~0.1ms effective budget per bar before hitting the total limit.Tip 1: Prefer ta.* over manual loops
All ta.* functions are implemented in Rust inside the sandbox host. They run orders of magnitude faster than equivalent JavaScript loops.
Tip 2: Reuse source identity for memoization
ta.* functions memoize their results per source function identity. If you pass the same function reference, the result from the previous bar is reused internally.
ctx.close, ctx.high, etc. directly - not as wrapped arrow functions.
Tip 3: Avoid Series proliferation
EachSeries consumes memory and lookup overhead. Prefer built-in ta.* functions that already maintain internal state.
Tip 4: Watch the 100K bar warmup cost
Indicators loaded on high-frequency pairs (1m candles on BTC) can have up to 100K historical bars. Expensive per-bar work multiplies:- A single
Math.sqrtcall per bar = ~0.01ms; across 100K bars = ~1s - Avoid nested loops; even O(n) JavaScript can be slow at 100K bars
ctx.isLast() to gate expensive operations to the realtime bar only:
Tip 5: Minimize entity creation in onBar
Creating a Line or Box on every bar using a dynamic key (Line(key_$, ...)) can quickly fill the 500-per-type entity budget on a 100K bar window. Use pivot-based triggers (only create on confirmed pivots) or a fixed pool of keys.
Tip 6: Guard NaN early
Returning early fromonBar when indicators are in warmup avoids cascading computation:
Related pages
API limits
All runtime budgets in one table.
Gotchas
Common mistakes that waste computation.
Troubleshooting
TIMEOUT errors and how to fix them.