The main purpose of these elements is to facilitate customization of the Trades Window columns by editing the standard Trades.rts script or providing an alternative Trades Section in a different script.
The trade record syntax can also be used in any Strategy Element formula to access certain details of trades which have occurred earlier in the current backtest. This allows you to model strategies which incorporate the concept of looking at past trades in a specific symbol to inform decisions about the next trade.
When used in this way, the context of the trade reference is always the current bar of the current symbol in the current strategy. To refer to trades that closed previously, Multi-Bar Functions and/or Bar Offsets must be used.
If a strategy specifies MaxSameSym > 1 to allow multiple positions in the same stock then T.Points, T.Profit, T.QtyIn and T.QtyOut return the sum for all trades with the same exit date (and symbol and strategy).
The following are a few examples of ways in which you might want to explore using this capability:
Example
Description
CountTrue(T.DateOut > 0, 10) > 0
a prior trade in this symbol was exited within the past 10 bars
Sum(T.Profit, 20) < -0.01 * S.Equity
recent trades in this symbol have lost more than 1% of equity
T.Reason = 2
a prior trade in this symbol just hit its target earlier today