strategy.close_all
Closes the whole position with a market order at the next bar open.
strategy.close_all(comment: string = na)
Parameters
commentstring: Text kept with the order; the trade it closes keeps the closing order's comment (default none).
Example
if hour(time_close, "America/New_York") == 16
strategy.close_all("Session end")