updated 15 March 2018

R/Finance 2018

You have a backtest, now what?

Why be skeptical?

"A good analyst should be very skeptical of their own results, lest they lose money deploying a bad strategy" - Brian Peterson

Simulate portfolio PL

  • Simulate the strategy to get a sense of the distribution of possible outcomes

  • for example, maximum drawdowns


Simulate round turn trades


  • Stylized facts
    • percent time in market versus out
    • ratio of duration long:short periods
    • number of levels or layered trades observed, limited by max position
  • Round turn trade definition
    • flat.to.flat
    • flat.to.reduced
    • increased.to.reduced

Longtrend demo

Bbands demo

plot "longtrend" round turn trades using txnsim

plot "longtrend" portfolio PL using mcsim

plot "bbands" using txnsim

Future Work

  • Additional simulation methodologies
    • CSCV per Bailey and Lopez de Prado
    • simulated or resampled market data
    • applying stylized facts to other market data
  • Additional models for analysing likelihood of overfitting
  • Adding configurability for type of stylized fact to include in the analysis
  • Optimisation


We believe txnsim() is a significant contribution for any analyst seeking to evaluate the question of "skill vs. luck" of the observed trades, or for more broadly understanding what is theoretically possible with a certain trading cadence and style.

Resources and References


  • Thank you for listening

  • Thank you to my family

  • Special thanks to:
    • Brian Peterson
    • Joshua Ulrich
    • Peter Carl
    • Jeff Ryan
    • Dirk Eddelbuettel
    • Ross Bennett
    • and many more package authors and community members