PureBytes Links
Trading Reference Links
|
You usually need to use the keyword "total" to get multiple exits to work right.
For the most control, do something like:
Exitlong ("Time ES1 LX") currentcontracts/2 contracts total from entry ("ES1") at market;
It's all spelled out in the TS2k easy language reference (pdf document).
Chapter 3, trading verbs, exitlong, starting on page 136.
--
Dennis
PS, for those who don't have it, here's what it says. It's easier to read in the
original pdf which should be available for download somewhere on the TS site.
Exitlong
This trading verb is used to close a long position. The specifics of the order are defined
by the optional components used in the statement (i.e., how many shares/contracts, at
what price, etc.).
Exit orders do not pyramid. Once the exit criteria is met and the exit order filled, the
order is ignored for that position until the position is modified (i.e., more shares/
contracts are bought or a new long position is established).
Syntax:
ExitLong [(“Order Name”)] [from entry (“Entry Name”)] [ Number of
Shares [Total]] [Execution Method];
Only the word ExitLong is required to exit a long position. For example:
ExitLong ;
The default values used for the rest of the expression when they are not specified are:
ExitLong (“LX”) This Bar on Close;
The above statement exits all long positions.
Each portion of the statement, Order Name, Number of Shares, and Execution Method
is described next.
Order Name
If your Trading Signal or Trading Strategy includes multiple exits, it is helpful to label
each one with a different name. As shown in Figure 3-13, this enables you to identify
these exit orders in both the price chart and the TradeStation Strategy Performance
Report. The order name is included in both these windows.
To assign an exit order a name, specify a name in quotation marks and within parentheses
immediately after the word ExitLong. For example:
ExitLong (“My Exit”);
This instruction closes the entire long 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 long entry, and the long entry is in the same Trading Signal as the exit order.
Consider the following Trading Signal:
Buy (“MyBuy”) 10 Shares Next Bar at Market;
Buy 20 Shares Next Bar at High + 1 Point Stop ;
ExitLong From Entry (“MyBuy”) Next Bar at High + 3 Points Stop;
In the above example, the Trading Signal buys 30 shares total; your long position is 30
shares. However, the ExitLong instruction only closes out the 10 shares bought using the
MyBuy entry order. It ignores any other order, and does not close out the other 20 shares.
Therefore, this signal leaves you long 20 shares.
You can also close padrt of an entry order. For example, if your entry, which you named
“MyBuy” buys 10 shares, you can specify that you want to exit from entry “MyBuy” but
only close out 5 shares, not the entire 10:
Exitlong From Entry (“MyBuy”) 5 Shares Next Bar at High + 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 buy/sell order) in
order to close out the position.
Number of Shares/Contracts
To specify how many shares (or contracts) to close, place a numeric expression followed
by the word shares or contracts after the trading verb ExitLong. Some examples:
ExitLong 100 Shares;
ExitLong From Entry (“MovAvg”) 10 Shares Next Bar at High + 1
Point Stop ;
Note: The words shares and contracts are synonymous.
If you do not specify the number of shares or contracts in the ExitLong instruction, the
exit order closes out the entire long position, rendering your position flat.
When you specify the number of shares/contracts, the ExitLong instruction exits the
specified number of shares/contracts from every open entry.
Therefore, if the Trading Strategy allows for pyramiding, and has bought 500 shares
twice (for a total of 1,000 shares), and an order to ExitLong 100 shares is placed by the
Trading Strategy, the instruction will exit a total of 200 shares: 100 shares from each of
the two entries. Figure 3-14 illustrates this example. After buying a total of 1,000 shares
(500 at two different entry points), the order based on the instruction Exitlong 100 shares
next bar at market exits a total of 200 shares, 100 from each entry, leaving you in a long
position consisting of 800 shares. The onscreen cues in Figure 3-14 show you how many
shares you hold in your current position.
However, if you want to exit a total of 100 shares, you can use the word Total in the
ExitLong instruction. Using the word Total instructs the Trading Strategy to exit 100
shares from the first open entry (first in, first out). This example is illustrated in Figure
3-15.
Figure 3-14. The instruction ‘ExitLong 100 shares next bar at market’ exits 100 shares out of each open entry.
Figure 3-15. The instruction ‘ExitLong 100 shares total next bar at market’ exits 100 shares out of the oldest open entr(ies).
Execution Method
You can use four different execution methods with the trading verb ExitLong:
... this bar on close
... next bar at market
... next bar at price Stop
... next bar at price Limit
The execution method this bar on close is provided for backtesting purposes only; it enables
you to backtest ‘market at close’ orders, which you use with TradeStation when trading
on a real-time/delayed basis. Given that all orders are read and executed at the end of
each bar, TradeStation evaluates and issues the this bar on close order once the bar has
closed (e.g., 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.
An order to ExitLong at price Limit instructs TradeStation to exit a long position at the first
opportunity at the specified price or higher. An ExitLong at price Stop instructs
TradeStation to exit a long position at the first opportunity at the specified price or lower.
Stop and limit orders are treated by TradeStation as market if touched (MIT) orders. It is
possible for stop and limit orders not to be filled (i.e., price never reached); in this case, the
orders are canceled at the close of the bar.
As a general guideline, traders use market and close orders when the exact entry price is
not critical to their trading strategy after a largemove occurred. They use limit orders when
they are attempting to exit long positions at higher prices, to exit at resistance levels, or to
exit at a top. And finally, they generally use stop orders whenever looking to stop losses,
or to place trailing stops. Again, these are common usage for the different type of orders;
they are flexible enough to be used in many different ways.
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 Trading Signal to refer to the value the numerical expression
Price had on the bar where the entry order was generated. Consider the following
statement:
ExitLong From Entry (“MyBuy”) Next Bar At$ Low - 1 Point Stop;
The above statement places an order to exit the long position at one point lower than the
low of the bar where the order to establish the long position was generated (e.g., if an order
to buy 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 ExitLong instruction
must refer to the specific entry order.
As another example, if the maximum risk you will tolerate for a position is 5 points under
the closing price of the bar on which you generated the entry order, you can use the following
statement:
ExitLong From Entry (“MyBuy”) 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.
Examples
This statement exits all contracts/shares of your open long position at the close of the
current bar. Your position will be flat.
ExitLong This Bar on Close;
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 the exit order is named LongExit.
ExitLong (“LongExit”) From Entry (“Entry#1”) Next Bar at Market;
The following statement places an order to close 5 contracts/shares in total at the low of the
current bar minus 1 point or anything lower. This order is active throughout the next bar
(until filled or canceled):
ExitLong 5 Contracts Total Next Bar at Low - 1 Point Stop;
The next instruction places an order to exit 100 shares from every entry at the high plus
the range of the current bar or anything higher. This order is active throughout the next
bar (until filled or canceled) and will be named HighExit.
ExitLong (“HighExit”) 100 Shares Next Bar at High + Range Limit;
The following statement allows you to monitor your risk by placing an exit order 5 points
below the closing price of the bar that generated the long entry order:
ExitLong From Entry (“MyBuy”) Next Bar At$ Close - 5 Points
Stop;
|