|
Category
Current Position Information
Description
True when the formula being evaluated pertains to a position being exited
Notes
IsExit is provided for the few strategy formulas that are evaluated at both entry time and exit time.
These include:
•Commission
•Slippage
•OrderNote / OrderExtra
Use IsExit in any of the above formulas as needed to differentiate entry vs. exit values.
For example in a long strategy you could account for the extra SEC Section 31 fee on the sale of shares:
Commission: 0.005 & Shares + if(IsExit, 8 * FillValue/1e6, 0)
When IsExit is used in a boolean expression such as in the above example, it is interpreted as a number (0 means false, 1 means true in all boolean conditions in RealTest).
IsExit itself is always numeric (0 or 1). To obtain the exit reason code as a string — for example to store it in an OrderExtra variable — use ExitType, which returns the exit reason string when the current formula pertains to an exit, as shown below.
OrderExtra3: Format("{?}", if(IsExit, ExitType, ""))
This stores the exit reason string in the extra3 variable for OrdersTemplate output.
|