Hi everyone ![]()
Iโve just released v1.1.0, and this update focuses on performance improvements, better reporting, and a cleaner, more powerful strategy API.
Below is a summary of whatโs new and why these changes were made.
I also recommend you to check docs for Strategy API
Performance improvements
- Internal execution and reporting have been optimized
- Backtests with large datasets are faster and more consistent
- Metrics are now calculated incrementally instead of post-processed
Metrics are now available inside strategies
Strategy scripts can now directly access performance metrics via the metrics object:
metrics.roi
metrics.pnl
metrics.equity
metrics.maxDrawdownPercentage
This makes it possible to:
- react to performance during execution
- implement risk limits (e.g. stop after drawdown)
- build adaptive strategies based on results
Positions & trades model finalized
The trading state is now clearly separated:
- Positions โ bought base waiting to be sold (unrealized PnL)
- Trades โ closed positions with realized PnL
You can access them via:
trader.positions
trader.trades.last(10)
This makes strategy logic and reporting much easier to reason about.
New orderStatus hook
A new hook has been added:
trader.addHook("orderStatus", (order) => {
// fires on every order update
});
This hook runs on:
- partial fills
- full fills
- cancellations
- any order status change
Itโs the recommended place to track fills, manage positions, and react to order lifecycle events.
Cleaner helper naming (crossUp, crossDown, crossAny)
Cross helpers are now camelCase for readability and consistency:
ta.crossUp(a, b)
ta.crossDown(a, b)
ta.crossAny(a, b)
This matches the rest of the Strategy API naming
ind.ref() โ explicit indicator output references
Multi-output indicators (like BBANDS or MACD) now use an explicit reference system:
ind.ref('bbands', 'lower')
ind.ref('macd', 'signal')
This is especially useful with helpers like crossUp:
if (ta.crossUp(
ind.ref('macd', 'macd'),
ind.ref('macd', 'signal')
)) {
await order.buy();
}
Why we dropped bbands.lower dot notation
Previously, dot notation was used to select indicator outputs (bbands.lower).
This worked, but it caused ambiguity and made it harder to:
- distinguish values vs references
- support helpers like
crossUpreliably - extend the API safely in the future
- keep visual scripting and code-based strategies consistent
ind.ref(name, output) makes intent explicit, avoids hidden parsing rules, and provides a much more robust foundation going forward.
Note: Visual scripting still shows user-friendly selectors (e.g.
BBANDS > Lower) and compiles them automatically โ no extra work needed.
Thanks
If you have questions or spot anything unexpected, feel free to reply here.
Happy trading ![]()