OPEN-SOURCE SCRIPT

Time-based Alerts for Trading Windows

🌟 Time-based Alerts for Trading Windows 🌐📈
This Time-based Alerts for Trading Windows script is a highly customizable and reliable tool designed to assist traders in managing automated strategies or manually monitoring specific market conditions. Inspired by CrossTrade's Time-based Alert, this script is tailored for those who rely on precise time windows to trigger actions, such as sending webhook signals or managing Expert Advisors (EAs).

Whether you are a scalper, day trader, or algorithmic trader, this script empowers you to stay on top of your trades with fully customizable time-based alerts.

🛠️ Customizable Time Alerts
This indicator allows you to create up to 12 unique time windows by specifying the exact hour and minute for each alert. Each time window corresponds to an individual alert condition, making it perfect for managing trades during specific market sessions or key time periods.

For example:
  1. Alert 1 can be set at 9:30 AM (market open).
  2. Alert 2 can be set at 3:55 PM (just before market close).
  3. Each alert can be toggled on or off in the indicator settings, allowing you to manage alerts without having to reconfigure your script.
  4. You can adjust the colours to fit any colour scheme you like!


🕒 Odd and Even Time Alerts
The script comes with three built-in alert type categories:
  1. Odd Alerts (marked with a green triangle on the chart): These correspond to odd-numbered inputs like Alert 1, Alert 3, Alert 5, and so on.
  2. Even Alerts (marked with a red triangle on the chart): These correspond to even-numbered inputs like Alert 2, Alert 4, Alert 6, and so on.
  3. You can also customize all 12 alerts individually to include a custom alert message

These alerts serve as a convenient way to differentiate between multiple trading strategies or market conditions. You can customize alert messages for odd and even alerts directly from TradingView’s alert panel.

🔗 Webhook Integration for Automation
This script is fully compatible with webhook-based automation. By configuring your alerts in TradingView, you can send signals to trading bots, EAs, or any third-party system. For example, you can:
  • Turn off an EA at a specific time (e.g., 3:55 PM EST).
  • Send buy/sell signals to your bot during predefined trading windows.
  • Simply use TradingView’s alert message editor to format webhook payloads for your automation system.


🌐 Timezone Flexibility
Trading happens across multiple time zones, and this script accounts for that. You can toggle between:
  • Eastern Time (New York): Ideal for most US-based markets.
  • Central Time (Exchange): Useful for futures and commodities traders.

This ensures your alerts are always in sync with your preferred time zone, eliminating confusion.

🎨Visual Indicators
The script plots visual markers directly on your chart to indicate active alerts:
  • Up Facing Triangles: Represent odd-numbered alerts, providing a quick reference for these time windows.
  • Down Facing Triangles: Represent even-numbered alerts, helping you track different strategies or conditions.

These visual markers make it easy to see when alerts are triggered, even at a glance.

In our chart example above, the blue triangles indicate the odd-numbered alerts and the yellow triangles the even-numbered alerts. You can set them to the colours of green and red if you prefer that!

📈 Practical Use Case
Let’s say you’re trading the USTEC index on a 1-minute chart. You want to:
  1. Turn off your trading bot at 16:55 EST to avoid after-market volatility.
  2. Trigger a re-entry signal at 17:30 EST to capture moves during the Asian session.
  3. Visually monitor these actions on your chart for easy reference.

This script makes it possible with precision alerts and webhook integration. Simply configure the time windows in the settings and set up your alerts in TradingView.

🚨 How to Set Up Alerts
  1. Enable or Disable Alerts: Use the script’s settings to toggle specific alerts on or off as needed.
  2. Set Custom Time Windows: Define the hour and minute for each alert in the settings panel.
  3. Create Alerts in TradingView:
  4. Go to the TradingView alert panel.
  5. Select the condition (e.g., "Odd Time-based Alert (Green)" or "Even Time-based Alert (Red)").
  6. Customize the alert message for webhook integration or personal notification.
  7. Choose the trigger type: Once Per Bar or Once Per Bar Close to keep the alert active.
  8. Integrate with Webhooks: Use the alert message field to format payloads for automation systems like MT4, MT5, or third-party bots.


📋 Key Notes
  • Alerts can trigger indefinitely if set to "Once Per Bar" or "Once Per Bar Close".
  • Always ensure the expiration date is set far in the future to avoid unexpected alert deactivation.
  • Test webhook messages and alert configurations thoroughly before using them in live trading.
  • This script is a powerful addition to your trading toolbox, offering precision, flexibility, and automation capabilities. Whether you’re turning off an EA, managing trades during market sessions, or automating strategies via webhooks, this script is here to support you.


Start using the Time-based Alerts for Trading Windows today and trade with confidence! 🚀✨

Acknowledgment
This indicator was created using the foundation code provided by CrossTrade.io. Huge thanks to their work for inspiring this customizable solution! Follow them here: CrossTradeTeam

Disclaimer