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
{{ message }}
Repository navigation
Order functions accept unknown named arguments, including the removed when, and drop them #286
The order functions accept any named argument and drop it without a message. Pine v6 removed the when parameter, and TradingView rejects it in v6, but a v6 script that still passes it translates: the condition disappears and the order is placed on every bar. Other built-ins reject unknown names, for example ta.sma(close, 10, when = true) fails with ta.sma has no parameter 'when'.
Versions
pineforge-codegen 1.9.1 and 1.9.0 (1.6.1 too). The run below used pineforge-engine v1.9.0 (ec44968), Apple clang, macOS arm64. The argument is dropped in the front end, so it should not depend on the platform.
Repro
//@version=6
strategy('repro')
strategy.entry('L', strategy.long, when = bar_index % 20 == 0)
strategy.close('L', when = bar_index % 20 == 10)
On a daily series from 2020-01-01 to 2024-01-01 (1,461 bars) this gives 673 trades; the conditions allow about 73.
The same happens with:
when = false on strategy.order, strategy.exit, strategy.cancel and strategy.cancel_all: all translate, with no condition left.
A name that never existed: strategy.entry('L', strategy.long, bogus = true) translates the same way.
Expected
Order functions reject unknown named arguments, as the other built-ins do. For when, a message saying that v6 removed it would help scripts migrated from v5.
Thank you for the detailed report. We are checking each case against TradingView's behaviour and our source, and will post a result for each case in this issue by the end of 2026-11-03 (UTC). If a case needs longer, we will say so here with the reason.
Thank you for the report. This is the result for each case on the released pineforge-codegen 1.10.0. The fix is planned for the next release (1.10.1), as the 1.10.0 release notes list for this issue.
Case
Result on 1.10.0
Matches TradingView?
when = ... on strategy.entry and strategy.close (your repro)
Translates; the argument is dropped, so the order is placed on every bar
No: TradingView v6 rejects when
when = false on strategy.order, strategy.exit, strategy.cancel, strategy.cancel_all
Translate; the argument is dropped
No: TradingView v6 rejects when
An argument name that never existed (bogus = true on strategy.entry)
Translates; the argument is dropped
No: TradingView rejects an unknown argument name
All three are defects, not intended behaviour: the order functions accept any named argument. Other built-ins already reject unknown names (as with your ta.sma(close, 10, when = true) control), and the order functions are to do the same, with a message for when that says v6 removed it. The fix is planned for the next release (1.10.1); the issue stays open until it is released.
The fix, merged in #327 (commit 08261a2), is on main and not yet released;
it ships in the next release and closes then. We ran your reporter script with when on strategy.entry and strategy.close; both calls now produce located
PF-E2027 unknown-keyword diagnostics instead of silently dropping their
conditions, matching TradingView's rejection. The other when and unknown-name
forms in the issue are covered by the public regression tests but were not part
of this reporter run. The current message is the generic “unknown keyword
argument 'when'”; the promised v6-specific wording is not on main yet.
Update: the argument rejection is fixed on main; the diagnostic wording remains generic.
The results below were checked on 2026-11-06 on main after #327 (08261a24) landed, as reported in our earlier comment. They were not re-run today; that comment identifies the fix commit but does not record the exact tested main commit.
Case
Result on main
Change
Matches TradingView?
when = ... on strategy.entry and strategy.close (your repro)
Both calls produce located PF-E2027 unknown-keyword diagnostics instead of dropping the condition
Rejection is covered; no separate reporter-script measurement
The message remains “unknown keyword argument 'when'”. Our earlier promise of wording that specifically explains its removal in v6 is not implemented on main; this update confirms the rejection, without claiming that wording change.
This is fixed on main and ships in 1.11.0, whose publish target is 2026-11-10. This issue will be closed when that release is published.
Fixed in v1.11.0: order functions now refuse unknown named arguments, and the removed when argument has its own error message (commit 08261a2 and #355). Closing.
Activity
luisleo526 commentedon Nov 1, 2026
Thank you for the detailed report. We are checking each case against TradingView's behaviour and our source, and will post a result for each case in this issue by the end of 2026-11-03 (UTC). If a case needs longer, we will say so here with the reason.
luisleo526 commentedon Nov 3, 2026
Thank you for the report. This is the result for each case on the released pineforge-codegen 1.10.0. The fix is planned for the next release (1.10.1), as the 1.10.0 release notes list for this issue.
when = ...onstrategy.entryandstrategy.close(your repro)whenwhen = falseonstrategy.order,strategy.exit,strategy.cancel,strategy.cancel_allwhenbogus = trueonstrategy.entry)All three are defects, not intended behaviour: the order functions accept any named argument. Other built-ins already reject unknown names (as with your
ta.sma(close, 10, when = true)control), and the order functions are to do the same, with a message forwhenthat says v6 removed it. The fix is planned for the next release (1.10.1); the issue stays open until it is released.luisleo526 commentedon Nov 6, 2026
The fix, merged in #327 (commit 08261a2), is on main and not yet released;
it ships in the next release and closes then. We ran your reporter script with
whenonstrategy.entryandstrategy.close; both calls now produce locatedPF-E2027 unknown-keyword diagnostics instead of silently dropping their
conditions, matching TradingView's rejection. The other
whenand unknown-nameforms in the issue are covered by the public regression tests but were not part
of this reporter run. The current message is the generic “unknown keyword
argument 'when'”; the promised v6-specific wording is not on main yet.
luisleo526 commentedon Nov 8, 2026
Update: the argument rejection is fixed on main; the diagnostic wording remains generic.
The results below were checked on 2026-11-06 on main after #327 (
08261a24) landed, as reported in our earlier comment. They were not re-run today; that comment identifies the fix commit but does not record the exact tested main commit.when = ...onstrategy.entryandstrategy.close(your repro)PF-E2027unknown-keyword diagnostics instead of dropping the condition08261a24)when = falseonstrategy.order,strategy.exit,strategy.cancel,strategy.cancel_all08261a24)bogus = trueonstrategy.entry)08261a24)The message remains “unknown keyword argument 'when'”. Our earlier promise of wording that specifically explains its removal in v6 is not implemented on main; this update confirms the rejection, without claiming that wording change.
This is fixed on main and ships in 1.11.0, whose publish target is 2026-11-10. This issue will be closed when that release is published.
Clarify unreleased fixes and numeric helper documentation (#353)
luisleo526 commentedon Nov 9, 2026
Fixed in v1.11.0: order functions now refuse unknown named arguments, and the removed
whenargument has its own error message (commit 08261a2 and #355). Closing.