EasyLanguage Reserved Words & Functions

BuyToCover (Reserved Word)

image\trumpet2.gif Disclaimer

This trading verb is used to cover a short position. The specifics of the order are defined by the optional components used in the statement (that is, how many shares/contracts, at what price, and so on).

Exit orders do not pyramid. Once the exit criteria are met and the exit order filled, the order is ignored for that position until the position is modified (that is, more shares/ contracts are sold or a new short position is established).

BuyToCover [("Order Name")] [from entry ("Entry Name")] [ Number of Shares/Contracts [Total]] [Order Action];

Only the word BuyToCover and the Order Action are required to exit a short position. The following is a complete Easy Language statement:

BuyToCover This Bar on Close;

If no other parameters are specified, the default value for the Order Name is "Cover", and all short contracts will be exited from the position.

Each portion of the statement, Order Name, Number of Shares, from entry and Order Action are described next.

Order Name

When using multiple exits within a strategy, it is helpful to label each exit order with a different name. This enables you to identify these exit orders in both the price chart and the Strategy Performance Report. To assign an exit order a name, specify a name in quotation marks and within parentheses immediately after the word BuyToCover. For Example:

BuyToCover ("My Exit") This Bar on Close;

This instruction closes the entire short position, and the order is labeled My Exit.

Tying an Exit to an Entry

It is possible to tie an exit instruction to a specific entry. This can be achieved only if you named the short entry, and the short entry is in the same strategy as the exit. Consider the following strategy:

SellShort ("MyShort") 10 Shares Next Bar at Market;
SellShort
20 Shares Next Bar at Low - 1 Point Stop ;

BuyToCover From Entry ("MyShort") Next Bar at Low - 3 Points Stop;

In the above example, the strategy may short 30 shares total; your short position is 30 shares. However, the BuyToCover instruction only closes out the 10 shares shorted using the MyShort entry order. It ignores any other order, and does not close out the other 20 shares. Therefore, this strategy leaves you short 20 shares.

You can also close part of an entry order. For example, if your entry, which you named "MyShort" buys 10 shares, you can specify that you want to exit from entry "MyShort" but only close out 5 shares, not the entire 10:

BuyToCover From Entry ("MyShort") 5 Shares Next Bar at Low - 3 Points Stop;

  Important The entry name is case sensitive. Be sure to use consistent capitalization. Also, it is important to remember that exit orders do not pyramid; therefore, if an exit does not close out a position, you will need another exit order (or reversal order) in order to close out a position.

Number of Shares/Contracts

To specify how many shares/contracts to close out, use a numeric expression followed by the word shares or contracts after the trading verb BuyToCover. Some Examples:

BuyToCover 100 Shares This Bar on Close;

BuyToCover From Entry ("MovAvg") 10 Shares Next Bar at Low - 1 Point Stop;

  The words shares and contracts are synonymous.

If you do not specify the number of shares/contracts in the BuyToCover instruction, the exit order closes out the entire short position, rendering your position flat.

When you specify the number of shares/contracts, the BuyToCover instruction exits the specified number of shares/contracts from every open entry.

Therefore, if the Strategy allows for pyramiding, and has shorted 500 shares three times (for a total of 1,500 shares), and an order to BuyToCover 100 Shares is placed by the Strategy, the exit order will exit a total of 300 shares: 100 shares from each one of the three entries.

However, if you want to exit a total of 100 shares, you can use the reserved word Total in the BuyToCover instruction. Using the word Total causes the Strategy to exit 100 shares from the first open entry (first in, first out). For Examples:

BuyToCover 100 Shares Total This Bar on Close;

BuyToCover From Entry ("MovAvg") 10 Shares Total Next Bar at Low - 1 Point Stop ;

Order Action

You must specify one of the five different order actions with your BuyToCover order.

... this bar on close;

... next bar at open;

... next bar at market;

... next bar at yourprice Stop;

... next bar at yourprice Limit;

The order action this bar on close is provided for backtesting purposes only; it enables you to back test ’market at close’ orders, which you cannot automate using TradeStation. Given that all orders are evaluated and executed at the end of each bar, TradeStation reads and issues the this bar on close order once the bar has closed (for example, once the daily trading session has ended). TradeStation fills the order using the close of the current bar, but you have to place an order at market to be executed on the next bar. This invariably introduces slippage.

The order action BuyToCover next bar at price Limit instructs TradeStation to exit a short position at the first opportunity at the specified price or lower. The order action BuyToCover next bar at price Stop instructs TradeStation to exit at the first opportunity at the specified price or higher.

By default, a strategy stop or limit order will be considered filled at the stop or limit price if that price falls within the range of the bar on which the order is active.  When automating a strategy, the user has the option of selecting whether to mark strategy orders as filled based on 'price activity' or when the TradeManager reports that the order was actually filled in the market.

Tying the Exit Price to the Bar of Entry

When specifying the execution method, you can vary stop and limit orders by using ’At$’ instead of ’at’. Using At$ forces the strategy to refer to the value the numerical expression price had on the bar where the entry order was generated. Consider the following statement:

BuyToCover From Entry ("MySell") Next Bar At$ High + 1 Point Stop;

The above statement places an order to exit the short position at one point higher than the high of the bar where the order to establish the short position was generated (for example, if an order to SellShort next bar... is generated today, the prices referenced will be today’s, not tomorrow’s. Even though the order was placed and filled tomorrow, it was generated today and that is the bar referenced).

To use the At$ reserved word, you must name the entry order, and the BuyToCover instruction must refer to the specific entry order.

As another example, if the maximum risk you will tolerate for a position is 5 points over the closing price of the bar on which you generated the entry order, you can use the following statement:

BuyToCover From Entry ("MySell") Next Bar At$ Close + 5 Points Stop;

This is a valuable technique that allows you to refer easily to the prices of the bar on which the entry order was generated.

Example

This statement exits all contracts/shares of your open short position at the close of the current bar. Your position will be flat.

BuyToCover This Bar on Close;

Additional Example

The next instruction exits all contracts/shares of your positions opened by the entry order Entry#1 at the open of the next bar, and this order is named ShortExit.

BuyToCover ("ShortExit") From Entry ("Entry#1") Next Bar at Market;

The following statement places an order to close 5 contracts in total at the high of the current bar plus 1 point or anything higher. This order is active throughout the next bar (until filled or canceled):

BuyToCover 5 Contracts Total Next Bar at High + 1 Point Stop;

The next instruction places an order to exit 100 shares out of every entry at the low minus the range of the current bar or anything lower. This order is active throughout the next bar (until filled or canceled), and is named LowExit.

BuyToCover ("LowExit") 100 Shares Next Bar at Low - Range Limit;

The following statement enables you to monitor your risk by placing an exit order 5 points over the closing price of the bar that generated the short entry order:

BuyToCover From Entry ("MySell") Next Bar At$ Close + 5 Points Stop;