anal yz ing y o u r strateg y
play

Anal yz ing y o u r strateg y FIN AN C IAL TR AD IN G IN R Il y a - PowerPoint PPT Presentation

Anal yz ing y o u r strateg y FIN AN C IAL TR AD IN G IN R Il y a Kipnis Professional Q u antitati v e Anal y st and R programmer O u r strateg y B uy w hen : 50- da y mo v ing a v erage > 200- da y mo v ing a v erage and d v o < 20 Sell


  1. Anal yz ing y o u r strateg y FIN AN C IAL TR AD IN G IN R Il y a Kipnis Professional Q u antitati v e Anal y st and R programmer

  2. O u r strateg y B uy w hen : 50- da y mo v ing a v erage > 200- da y mo v ing a v erage and d v o < 20 Sell w hen : 50- da y mo v ing a v erage < 200- da y mo v ing a v erage or d v o > 80 FINANCIAL TRADING IN R

  3. R u n y o u r strateg y Appl y y o u r strateg y applyStrategy(strategy = strategy.st, portfolios = portfolio.st) Update the portfolio updatePortf(portfolio.st) daterange <- time(getPortfolio(portfolio.st)$summary)[-1] Update the acco u nt updateAcct(account.st, daterange) updateEndEq(account.st) FINANCIAL TRADING IN R

  4. tStats <- tradeStats(Portfolios = portfolio.st) tStats Portfolio Symbol Num.Txns Num.Trades Net.Trading.PL LQD firstStrat LQD 382 156 25681.09 Avg.Trade.PL Med.Trade.PL Largest.Winner Largest.Loser LQD 164.6223 363.0143 2981.424 -7012.523 Gross.Profits Gross.Losses Std.Dev.Trade.PL Percent.Positive LQD 77251.33 -51570.24 1174.442 66.66667 Percent.Negative Profit.Factor Avg.Win.Trade Med.Win.Trade LQD 32.69231 1.497983 742.8012 624.5683 Avg.Losing.Trade Med.Losing.Trade Avg.Daily.PL Med.Daily.PL LQD -1011.181 -660.7456 164.6223 363.0143 Std.Dev.Daily.PL Ann.Sharpe Max.Drawdown Profit.To.Max.Draw LQD 1174.442 2.225141 -10625.62 2.416903 Avg.WinLoss.Ratio Med.WinLoss.Ratio Max.Equity Min.Equity LQD 0.7345877 0.9452477 27567.98 -1550.332 End.Equity LQD 25681.09 FINANCIAL TRADING IN R

  5. Characteristics of trading s y stems S y stems based on mo v ing a v erage / trend signals High a v erage w in / loss ratio ( greater than 1) Lo w percent positi v e ( less than 50%) S y stems based on oscillation / re v ersion signals : High percent positi v e ( greater than 50%) Lo w a v erage w in / loss ratio ( less than 1) FINANCIAL TRADING IN R

  6. Let ' s practice ! FIN AN C IAL TR AD IN G IN R

  7. Vis u ali z ing y o u r strateg y FIN AN C IAL TR AD IN G IN R Il y a Kipnis Professional Q u antitati v e Anal y st and R programmer

  8. The chart . Posn f u nction chart.Posn() gi v es a good � rst glance at strateg y performance chart.Posn(portfolio = portfolio.st, Symbol = "LQD") FINANCIAL TRADING IN R

  9. What it looks like FINANCIAL TRADING IN R

  10. Adding indicators to charts Recalc u late indicators o u tside of strateg y to add to chart sma50 <- SMA(x = Cl(LQD), n = 50) sma200 <- SMA(x = Cl(LQD), n = 200) dvo <- DVO(HLC = HLC(LQD), nAvg = 2, percentLookback = 126) Add indicators w ith add_TA() command . Use on = 1 to add to price plot chart.Posn(Portfolio = portfolio.st, symbol = "LQD") add_TA(sma50, on = 1, col = "blue") add_TA(sma200, on = 1, col = "red")add_TA(dvo) FINANCIAL TRADING IN R

  11. Zoomed in Use zoom_Chart("date1/date2") to get a closer look zoom_Chart("2007-08/2007-12") res u lts in : FINANCIAL TRADING IN R

  12. Let ' s practice ! FIN AN C IAL TR AD IN G IN R

  13. Additional anal y tics FIN AN C IAL TR AD IN G IN R Il y a Kipnis Professional Q u antitati v e Anal y st and R programmer

  14. Generate profit & loss ( P & L ) series The blo � er en v ironment contains histor y of transactions S y nta x for P & L : portPL <- .blotter$portfolio.firstStrat$summary$Net.Trading.PL head(portPL) Net.Trading.PL 1999-01-01 0 2003-01-02 0 2003-01-03 0 2003-01-06 0 2003-01-07 0 2003-01-08 0 FINANCIAL TRADING IN R

  15. Sharpe ratio Can be obtained u sing P & L from y o u r strateg y Is the ratio of re w ard to risk from y o u r strateg y SharpeRatio.annualized(portPL, geometric = FALSE) Net.Trading.PL Annualized Sharpe Ratio (Rf=0%) 0.04879364 FINANCIAL TRADING IN R

  16. Getting ret u rns head(instrets, n = 3) Ratio bet w een pro � t or loss on a gi v en trade , di v ided b y LQD.DailyEndEq initial eq u it y 2003-01-02 0 2003-01-03 0 Obtaining portfolio ret u rns : 2003-01-06 0 instrets <- PortfReturns(account.st) tail(instrets, n = 3) LQD.DailyEndEq 2015-12-29 0 2015-12-30 0 2003-12-31 0 FINANCIAL TRADING IN R

  17. Getting Sharpe ratio for ret u rns SharpeRatio.annualized(instrets, geometric = FALSE) LQD.DailyEndEq Annualized Sharpe Ratio (Rf=0%) 0.488011 FINANCIAL TRADING IN R

  18. Let ' s practice ! FIN AN C IAL TR AD IN G IN R

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend