Alerts & Webhooks

How to Send a Pre-Close Alert to Flatten Positions on TradingView

A new script for TradingView allows users to send pre-close alerts and flatten positions before the session ends. With granular control and multi-time frame functionality, this tool simplifies intraday position management.

Tom Hartman

Marketing

2 Min Read Reviewed by Mike Christensen Fact-checked by Mike Christensen
BluSky — The Future of Trading. Prop firm futures trading. Sign up at BluSky.pro.

Many TradersPost users ask how to send an alert on TradingView to automatically flatten positions before the session ends. This functionality can be useful for day traders or those managing risk who want to exit their positions before the market closes.

Pre-Close Alert Script

A new script has been developed for this exact purpose. The script allows you to send an alert at the start or just before the end of the trading session. You can customize the session time and even the time zone in the script’s settings. This feature leverages a new time method in Pine Script that allows users to look up to 500 bars into the future, which helps determine the end of the session and trigger alerts accordingly.

Granular Control

The script also allows granular control over when the alert is fired. For example, if you’re trading on a 15-minute chart but don’t want to close your positions exactly at 3:45 p.m., you can configure the alert to fire at a specific point within the last candle of the session. This is done by breaking down the candle into smaller intervals (seconds or sub-timeframe bars). This flexibility allows traders to fine-tune exactly when they want the system to send the signal to flatten positions.

Multi-Time Frame Alerts

For those using daily strategies, you can set up alerts on lower time frames, such as the one-minute or five-minute chart, while still running your strategy on a daily chart. This method allows the alert to fire at the right time without affecting the main analysis performed on the higher time frame. This flexibility can be especially useful for those who want to manage intraday exit strategies while maintaining a broader daily view.

Conclusion

This new alert script, available in the TradersPost library, simplifies the process of flattening positions before the market closes. It can be customized for different time frames and provides granular control over when the alerts are fired, offering traders more flexibility in managing their positions.

  • Video
    Alerts & Webhooks Jul 10, 2026

    Event-Driven TradingView Alerts for Automation

    Learn to build event-driven TradingView alerts, send webhooks to TradersPost, and paper trade automated buy, sell, exit, and reverse orders safely today.

  • Video
    Alerts & Webhooks Apr 12, 2026

    Automate TradingView AI Alerts

    Learn how to connect TradingView AI Chart Copilot insights to automated trade execution using TradersPost webhooks, step by step.

  • Video

    What are TradingView Webhooks?

    TradingView integration guide: setup, features, automation options, and broker connectivity for enhanced trading.

Start trading at scale today. Sign up for free.

Free 7-day trial

Set-up in 3 minutes

Paper account for testing

TradersPost operates as a non-custodial automated trading platform, enabling users to connect alerts from their preferred trading platforms to their selected brokerage or exchange accounts. It abstains from the transmission, custody, or management of customer funds, covering both traditional and cryptocurrency assets. Typically, registration requirements set by regulatory entities such as the SEC, FINRA, or FinCEN apply to entities that hold or transmit customer funds. To ensure ongoing compliance, TradersPost regularly engages with regulatory authorities to confirm its adherence to all relevant local and federal laws.

TradersPost does not provide alerts, signals, research, analysis, or trading advice of any kind. It is designed to assist traders and investors in making their own trading decisions based on their alerts. The platform does not offer recommendations regarding securities to buy or sell, nor does it provide trading or investing advice. The platform and its features, capabilities, and tools are provided 'as-is' without any warranty.

Risk Disclosure: The use of automated trading systems involves inherent risks, including the potential for significant financial loss. These systems operate based on predetermined algorithms that may not fully adapt to changing market conditions, possibly making them unsuitable for some investors. Individuals are advised to thoroughly assess their financial situation and risk tolerance before using this platform.

Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.

© 2026 TradersPost, Inc. All rights reserved.