OPEN-SOURCE SCRIPT
Close All Positions

Close All Positions is a lightweight, time‑based exit tool for TradingView. Add it to any chart and tell it exactly when (hour + minute + timezone) you want every open position on that symbol closed. When the clock matches your settings, the script:
1. Fires a one‑time alert with your custom message (perfect for routing to a broker via webhook).
2. Drops a ▼ label on the bar where the exit signal occurred, time‑stamped in the tooltip for easy verification.
Key settings
Time: Choose any hour (1‑24) and minute (0‑59) for the exit trigger.
Timezone: Select the reference zone (e.g., UTC‑5) so your end‑of‑day lines up regardless of chart or broker time.
Alert Message: Type the text you want sent in the alert payload—add JSON if a webhook needs extra fields.
Typical use‑cases
End‑of‑Day Flat: Force‑exit intraday trades before the market closes.
Funding Avoidance (Crypto): Close positions just before the funding snapshot.
Risk Controls: Mandate flat exposure at a scheduled portfolio review time.
Tips
For minute‑level precision, run the indicator on a 1‑minute chart. On higher timeframes, the alert fires on the first bar that envelops your chosen minute.
Apply the script to every symbol you trade (or use a multi‑symbol alert group) if you need a blanket portfolio shutdown.
Pair it with a broker integration (TradersPost, etc.) so the alert automatically submits market‑close orders—no manual clicks required.
That’s it! Drop Close All Positions on the chart, set the clock, and let it take the “did I remember to close?” worry off your plate.
1. Fires a one‑time alert with your custom message (perfect for routing to a broker via webhook).
2. Drops a ▼ label on the bar where the exit signal occurred, time‑stamped in the tooltip for easy verification.
Key settings
Time: Choose any hour (1‑24) and minute (0‑59) for the exit trigger.
Timezone: Select the reference zone (e.g., UTC‑5) so your end‑of‑day lines up regardless of chart or broker time.
Alert Message: Type the text you want sent in the alert payload—add JSON if a webhook needs extra fields.
Typical use‑cases
End‑of‑Day Flat: Force‑exit intraday trades before the market closes.
Funding Avoidance (Crypto): Close positions just before the funding snapshot.
Risk Controls: Mandate flat exposure at a scheduled portfolio review time.
Tips
For minute‑level precision, run the indicator on a 1‑minute chart. On higher timeframes, the alert fires on the first bar that envelops your chosen minute.
Apply the script to every symbol you trade (or use a multi‑symbol alert group) if you need a blanket portfolio shutdown.
Pair it with a broker integration (TradersPost, etc.) so the alert automatically submits market‑close orders—no manual clicks required.
That’s it! Drop Close All Positions on the chart, set the clock, and let it take the “did I remember to close?” worry off your plate.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.