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.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.