Buy (Reserved Word)

image\trumpet2.gif Disclaimer

The Buy order is used to establish a long position. If there is an existing open short position, an order to cover the short position is sent first. Once the short position is closed, the Buy order is sent to establish the long position. The order specifications are defined by parameters in the Buy statement.

Buy [("Order Name")] [Number of Shares/Contracts] [Order Action];

Only the word Buy and the Order Action are required by the order syntax rules. For example:

Buy next bar at open;

or

Buy next bar at 45 stop;

If no order name is specified, the default name for the order will be "Buy". If the number of shares (or contracts) is not specified, then the number of shares is determined by the amount specified in the Trade size section of the Strategy Properties for all Strategies dialog box.

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

Order Name

When using multiple long entries within a strategy, it is helpful to label each entry order with a different name. By naming entry orders, you can easily identify all positions, both on the chart and in the Strategy Performance Report under the Trades tab. Also, naming the entry orders allows you to tie an exit to a particular entry order. For more details, see Sell.

To name a long entry order, include a descriptive name in quotation marks and within parenthesis after Buy. For example:

Buy ("MyFirstEntry") next bar at open;

This instruction initiates a long position named "MyFirstEntry".

Number of Shares/Contracts

To specify how many shares (or contracts) to buy, place a numeric expression followed by the words shares (or contracts) after Buy and after the entry order name, if used. For example:

Buy ("My Entry") 100 shares next bar at open;

Buy 5 contracts next bar at 100.50 limit;

Buy Value1 shares next bar at 100.50 limit; (Where Value1 is a variable value calculated within the strategy.)

  The words shares and contracts are synonymous.

If the number of shares/contracts is not specified, the value entered under the Trade size section of the Strategy Properties for all Strategies dialog box is used. The Trade size section controls the number of contracts or shares traded; this can be set to either a fixed number of shares/contracts or dollars per transaction. The trading strategy engine uses whatever is specified in the strategy code and will override the Strategy Properties for all Strategies settings.

Order Action

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

... this bar on close;

... next bar at open;

... next bar at market;

... next bar at yourprice Stop;

... next bar at yourprice Limit;

Strategy orders are generated on the bar close event and placed in the market based on the order action. For example:

Buy this bar on close;

When this order is generated, the following actions are taken:

  • A Buy arrow is placed on the current bar at the close tick mark.

  • If the order is generated on an intra-day bar and not the last bar on the chart, the order is sent directly into the market as a market order.

  • If the order is generated on an intra-day bar and it is the last bar on the chart, or it is a daily, weekly, or monthly chart, then the order is sent directly to the after hours market as a Day+ limit order at the price at the close of the bar. If it is not filled in the after hours session, then the order will be placed as a limit order on the open of the next trading day.

For example:

Buy next bar at market;

When this order is generated, the following actions are taken:

  • A Buy arrow is placed on the next bar at the open tick mark.

  • If the order is generated on an intra-day bar and not the last bar on the chart, the order is sent directly to the market as a market order.

  • If the order is generated on an intra-day bar and it is the last bar on the chart, or it is a daily, weekly, or monthly chart, then the order is held until the open of the next trading day and sent as a market order.

For example: 

Buy next bar at 50 limit;

When this order is generated, the following actions are taken:

  • If the stock or future trades at 50 or less, a buy arrow is placed on the next bar at the first tick price of 50 or less.

  • If the order is generated on an intra-day bar and not the last bar on the chart, the order is sent directly to the market as a limit order.

  • If the order in generated on an intra-day bar and it is the last bar on the chart, or it is a daily, weekly, or monthly chart, then the order is held until the open of the next trading day and sent as a limit order.

For example:

Buy next bar at 50 stop;

When this order is generated, the following actions are taken:

  • If the stock or future trades at 50 or higher, a buy arrow is placed on the next bar at the first tick price of 50 or higher.

  • If the order is generated on an intra-day bar and not the last bar on the chart, the order is held in the TradeManager window until the stop price is penetrated; then an order is sent directly to the market as a market order.

  • If the order is generated on an intra-day bar and it is the last bar on the chart, or it is a daily, weekly, or monthly chart, then the order is held until the open of the next trading day and held in the TradeManager window until the stop price is penetrated; then an order is sent directly to the market as a market order.

Stop orders are held on your computer and are not reflected in the market until the stop price is penetrated. If you turn off your computer, the order will not have an opportunity to be placed and filled.

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.

Additional Examples

This statement buys the default number of contracts/shares specified in the Trade size section of the Strategy Properties for all Strategies dialog box at the open of the next bar, and names this entry order Entry#1:

Buy ("Entry#1") next bar at market;

The next statement places an order to buy 5 contracts at the high of the current bar plus the range of the current bar, or any price higher. Note that Range is an EasyLanguage function that returns the high minus the low. This order remains active throughout the next bar (until filled or canceled):

Buy 5 contracts next bar at High + Range stop;

The next statement places an order to buy 100 shares at the lowest low of the last 10 bars, or any price lower. This order remains active throughout the next bar (until filled or canceled), and the order is named LowBuy:

Buy ("LowBuy") 100 shares next bar at Lowest(Low, 10) limit ;