You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
timestamp(dateString) without a zone is UTC. A date string with no time zone ("2022-01-01", "01 Jan 2022 00:00", "Jan 2022") was read in the exchange timezone; TradingView always reads it as UTC. On a symbol outside UTC such timestamps move by the exchange offset.
Pine objects compare by reference. UDT instances, chart.point, footprint and volume_row objects no longer compare equal field by field, so array.includes, array.indexof and array.lastindexof find only the same object, as on TradingView. The old field-wise comparison also depended on the Python version (CPython 3.13 dropped the identity shortcut, so objects holding the same na compared equal on 3.11/3.12 only).
ScriptRunner.run_iter() yields its own containers per bar. Each bar now gets a fresh plot_data dict and new_trades list, so results can be kept (list(runner.run_iter())). Before, the runner handed out the same dict and list every bar and emptied them for the next one. run_iter(copy_results=False) keeps the old, copy-free behavior for loops that read each bar before the next.
Programmatic overrides are no longer written into the script's .toml.ScriptRunner(inputs=...) used to persist its values into the .toml next to the script, so a later run without overrides silently inherited them. Overrides now apply to their own run only.
Features
Programmatic script settings
ScriptRunner(settings={...}) overrides the script's own settings (the arguments of the script.indicator / script.strategy decorator: initial_capital, commission_type, commission_value, default_qty_type, pyramiding, ...) for one run, on top of the .toml. Security contexts run with the same settings.
import_script(path, inputs=..., settings=..., save_overrides=False) loads a script with overrides without running it; save_overrides=True writes them into the .toml (for settings editors).
Script.settable_fields(), Script.default(key) and Script.set_setting(key, value) expose the settings, the values the script itself declares, and a validated override. A .toml value equal to the declaration is no override and is saved commented out; an unknown setting raises ValueError; the .toml accepts commission_type = "cash" like the decorator.
Fixes
Strategy
close_entries_rule = "ANY" margin calls match TradingView: a margin call cuts every open trade and stays a live order that cuts each later trade once at its first margin checkpoint until the position goes flat; strategy.close(id, qty_percent) takes the percent of the entry's original quantity; in a level batch an exit leg whose trades are already closed runs after the legs that still have trades to close.
A short is margin-checked at the low after the descending leg; when the low is in surplus but the fill price was short of margin, the cut is sized at the fill price. The bar-close margin check sizes the cut in lots instead of whole contracts.
strategy.order rounds its limit and stop levels to the tick grid in the right direction (they were reversed), and an order that fits against the bar-start position is no longer rejected after a same-bar exit flattened that position.
strategy.entry / strategy.order with both stop and limit is a single stop-limit order: it rests as a stop, its trigger turns it into a limit that fills at the trigger price when marketable, otherwise later at its limit (including the same bar's return leg). Re-issuing it with the same prices keeps the triggered state. A default-sized stop-limit is sized at min(max(stop, close), limit) of the placement bar.
Sub-lot close quantities: a qty_percent share below one lot closes one lot in strategy.close and strategy.exit legs when at least one lot is available; an explicit qty that floors to zero lots acts like an omitted qty; a negative strategy.close qty closes its absolute value.
request
An aggregated bar's volume is the exact decimal sum of the source volumes, as on TradingView. The binary float sum was an ulp off on many bars, which carried into volume-weighted series on aggregated request.security contexts.
Date strings
timestamp(dateString) skips leading words (a weekday, a zone name, any word), honours a trailing RFC 2822 zone name (EST, PDT, UT, GMT, ...) or Z, and a month-name date without a time ignores its zone and rejects a bare offset, matching TradingView.
Runtime and CLI
pyne run in provider mode refreshes the symbol metadata from the venue on every run instead of reusing a cached .toml, so newly announced holidays and trading breaks reach the session calendar. When the refresh fails and a cached copy exists, the run continues on it with a warning.
A library script imported by the script no longer consumes the programmatic inputs meant for the script, and a failed script import no longer leaves its overrides behind for the next import.
Documentation
Programmatic usage: overriding inputs and settings, their precedence over the .toml, import_script, and result copies. inputs keys are the main() parameter names (the docs wrongly said the input title). The SymInfo examples now pass the required mincontract, and the integration patterns define the run_strategy helper they use.
TradingView comparison figures refreshed (Pyne in the Wild: 1,000 scripts).