The quantiles of your trade statistics get to the heart of quantitatively setting rational stops and possibly even profit taking targets for a trading strategy or system. When applied to theoretical trades from a backtest, they may help to adjust parameters prior to trying the strategy with real money. When applied to real historical trades, they should help in examining what is working and where there is room for improvement in a trading system or strategy.
string identifying the portfolio
string identifying the symbol to examin trades for. If missing, the first symbol found in the
string specifying 'cash', or 'percent' for percentage of investment, or 'tick'
vector of probabilities for
any other passthrough parameters
This function will use the
quantile function to calculate
quantiles of per-trade net P&L, MAE, and MFE using the output from
perTradeStats. These quantiles are chosen by the
parameter and will be calculated for one or all of
'cash','percent',or 'tick', controlled by the
Quantiles will be calculated separately for trades that end positive (gains)
and trades that end negative (losses), and will be denoted
'pos' and 'neg',respectively.
Additionally, this function will return the MAE with respect to
the maximum cumulative P&L achieved for each
scale you request.
Tomasini&Jaekle recommend plotting MAE or MFE with respect to cumulative P&L
and choosing a stop or profit target in the 'stable region'. The reported
max should help the user to locate the stable region, perhaps mechanically.
There is room for improvement here, but this should give the user
information to work with in addition to the raw quantiles.
For example, it may make more sense to use the max of a loess or
kernel or other non-linear fit as the target point.
Brian G. Peterson
Tomasini, E. and Jaekle, U. Trading Systems - A new approach to system development and portfolio optimisation (ISBN 978-1-905641-79-6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.