Description Usage Arguments Details Value Author(s) References See Also
One 'trade' is defined as the entire time the symbol is not flat. It may contain many transactions. From the initial transaction that moves the position away from zero to the last transaction that flattens the position is all one 'trade' for the purposes of this function.
1 2 | perTradeStats(Portfolio, Symbol, includeOpenTrade = TRUE,
tradeDef = "flat.to.flat", ...)
|
Portfolio |
string identifying the portfolio |
Symbol |
string identifying the symbol to examin trades for. If missing, the first symbol found in the |
includeOpenTrade |
whether to process only finished trades, or the last trade if it is still open, default TRUE |
tradeDef |
string to determine which definition of 'trade' to use. Currently "flat.to.flat" (the default) and "flat.to.reduced" are implemented. |
... |
any other passthrough parameters |
This is sometimes referred to as 'flat to flat' analysis.
Note that a trade that is open at the end of the measured period will be marked to the timestamp of the end of the series. If that trade is later closed, the stats for it will likely change. This is 'mark to market' for the open position, and corresponds to most trade accounting systems and risk systems in including the open position in reporting.
A data.frame
containing:
the POSIXct
timestamp of the start of the trade
the POSIXct
timestamp of the end of the trade, when flat
the initial position on opening the trade
the maximum (largest) position held during the open trade
the number of transactions included in this trade
the largest notional investment cost of this trade
net trading P&L in the currency of Symbol
Maximum Adverse Excursion (MAE), in the currency of Symbol
Maximum Favorable Excursion (MFE), in the currency of Symbol
net trading P&L in percent of invested Symbol
price gained or lost
Maximum Adverse Excursion (MAE), in percent
Maximum Favorable Excursion (MFE), in percent
net trading P&L in ticks
Maximum Adverse Excursion (MAE) in ticks
Maximum Favorable Excursion (MFE) in ticks
Brian G. Peterson, Jan Humme
Tomasini, E. and Jaekle, U. Trading Systems - A new approach to system development and portfolio optimisation (ISBN 978-1-905641-79-6)
chart.ME
for a chart of MAE and MFE derived from this function,
and tradeStats
for a summary view of the performance
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.