# Trading Window

## **Alert-Level Trading Windows**&#x20;

By request, we've added the ability to set trading windows at the alert level in addition to your Master Trading Windows on the XT Control Panel. The fields `start_time` and `end_time` can be used to dictate the valid window of time signals are allowed to pass through to NT8.

Just like the Control Panel, all time values are in US/Eastern market time, or NYC time. You can set either a `start_time` or an `end_time` or both. If only a start time exists, if the current time exceeds the start time, the alert is accepted. Similarly, if the current time is less than the end time, the alert is accepted. If both times are set, the current time must be between both times.

{% hint style="info" %}
Both the alert-level trading window and the XT Control Panel trading window can be used at the same time and will both be evaluated if set.
{% endhint %}

#### Closing Only

In addition to `start_time` and `end_time` there's also the option `closing_only_after` available at the alert level, which behaves identically to the XT Control Panel closing only filter.

`closing_only_after` will allow only closing/exit orders to pass through after the specified time. To use it, both a `start_time` and `end_time` must be set. Typically, the `closing_only_after` time will be between the `start_time` and `end_time`.

{% hint style="warning" %}
Sending a PLACE order with the `flatten_first` flag enabled will process the CLOSEPOSITION action but block the subsequent PLACE command.
{% endhint %}

### Time Formats

Valid formats for times are any of the following in 12- or 24-hour clock format.

Representing 1:30 AM ET:

* 01:30
* 01:30 AM
* 01:30AM
* 1:30
* 1:30 AM
* 1:30AM

Representing 1:30 PM ET:

* 13:30
* 01:30 PM
* 01:30PM
* 1:30 PM
* 1:30PM

### Example Payload

The following alert will only be processed if the current market time (US/Eastern, NYC time) is between the `start_time` and `end_time`.

> key=your-secret-key;\
> command=place;\
> account=sim101;\
> instrument=ES 06-26;\
> action=buy;\
> qty=1;\
> order\_type=market;\
> tif=day;\
> **start\_time=9:30 AM;**\
> **end\_time=4:00 PM;**

If you only want CrossTrade to accept closing orders after 3:00 PM, your message might look like this:

> key=your-secret-key;\
> command=place;\
> account=sim101;\
> instrument=ES 06-26;\
> action=buy;\
> qty=1;\
> order\_type=market;\
> tif=day;\
> **start\_time=9:30 AM;**\
> **end\_time=4:00 PM;**\
> **closing\_only\_after=3:30 PM;**
