calculate flat to flat per-trade statistics
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.
string identifying the portfolio
string identifying the symbol to examin trades for. If missing, the first symbol found in the
whether to process only finished trades, or the last trade if it is still open, default TRUE
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.
POSIXcttimestamp of the start of the trade
POSIXcttimestamp 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
Maximum Adverse Excursion (MAE), in the currency of
Maximum Favorable Excursion (MFE), in the currency of
net trading P&L in percent of invested
Symbolprice 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,
tradeStats for a summary view of the performance
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.