perTradeStatsExt: calculate flat to flat per-trade statistics

Description Usage Arguments Details Value Author(s) References See Also

Description

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.

Usage

1
2
3
perTradeStatsExt(Portfolio, Symbol, includeOpenTrade = TRUE,
  tradeDef = "flat.to.flat", includeInitialExitTransaction = TRUE,
  Dates = NULL, ...)

Arguments

Portfolio

string identifying the portfolio

Symbol

string identifying the symbol to examine trades for. If missing, the first symbol found in the Portfolio portfolio will be used

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

Details

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.

Value

A data.frame containing:

Start

the POSIXct timestamp of the start of the trade

End

the POSIXct timestamp of the end of the trade, when flat

Init.Pos

the initial position on opening the trade

Max.Pos

the maximum (largest) position held during the open trade

Num.Txns

the number of transactions included in this trade

Max.Notional.Cost

the largest notional investment cost of this trade

Net.Trading.PL

net trading P&L in the currency of Symbol

MAE

Maximum Adverse Excursion (MAE), in the currency of Symbol

MFE

Maximum Favorable Excursion (MFE), in the currency of Symbol

Pct.Net.Trading.PL

net trading P&L in percent of invested Symbol price gained or lost

Pct.MAE

Maximum Adverse Excursion (MAE), in percent

Pct.MFE

Maximum Favorable Excursion (MFE), in percent

tick.Net.Trading.PL

net trading P&L in ticks

tick.MAE

Maximum Adverse Excursion (MAE) in ticks

tick.MFE

Maximum Favorable Excursion (MFE) in ticks

Author(s)

Brian G. Peterson, Jan Humme

References

Tomasini, E. and Jaekle, U. Trading Systems - A new approach to system development and portfolio optimisation (ISBN 978-1-905641-79-6)

See Also

chart.ME for a chart of MAE and MFE derived from this function, and tradeStats for a summary view of the performance


cloudcello/rfintools documentation built on May 13, 2019, 8:17 p.m.