|
Category
Current Position Information
Description
Previous exit stop price
Notes
At position entry time, PrevExitStop is initialized so that it will not limit the first bar's stop: a large negative value for a long position (so Max() returns the new ExitStop level) or a large positive value for a short position (so Min() returns the new level).
On each bar that the position is open, after the ExitStop formula is calculated, its value is placed in PrevExitStop.
This makes it possible to implement a "trailing stop", or any type of price stop concept that needs to refer to its own prior value to be calculated.
(Previously this required using the Data Section and was therefore more complex.)
It is also possible for a strategy to refer to the current exit stop price of another strategy by using Extern(@other, PrevExitStop).
Examples
This is a very simple trend-following strategy with a 3*ATR trailing stop:
.png)
Example
ExitStop: Max(PrevExitStop, C - 2 * ATR(14))
Trailing stop: today's stop is the higher of yesterday's stop or a new ATR-based level.
|