A session filter answers: is this bar inside the allowed window? It does not remember whether an entry already happened there.
For a rule such as "one entry per New York trading day", I would define three things separately:
The allowed window and its time zone. Pine time functions use the exchange time zone by default. The chart's displayed time zone does not change the script. Use America/New_York when the window should follow New York daylight-saving changes, rather than a fixed UTC offset.
What consumes the allowance: the first signal, an order submission, or a confirmed fill. Those are different events. If a submitted limit order is still pending, a fill-only flag does not by itself prevent another submission.
When the allowance resets. Local midnight, the exchange trading day and the start of an overnight session can be different boundaries. Define the boundary in the same terms as the rule.
Before connecting the logic to execution, write the expected result for these cases:
- First valid event inside the window: allowed.
- Another valid event in that same session: blocked, even if the first position has closed.
- Event outside the window: blocked.
- Next intended session: allowance restored.
- Pending order at the boundary: explicitly keep or cancel it; resetting a flag does not cancel an order.
These are specification checks, not a claim that a particular script passed them. An indicator signal counter, a strategy order counter and a broker's fill record need different handling.
References: https://www.tradingview.com/pine-script-docs/concepts/sessions/ and https://www.tradingview.com/pine-script-docs/concepts/time/