Visualizing your strategy

Financial Trading in R

Ilya Kipnis

Professional Quantitative Analyst and R programmer

The chart.Posn function

chart.Posn() gives a good first glance at strategy performance

chart.Posn(portfolio = portfolio.st, Symbol = "LQD")
Financial Trading in R

What it looks like

Financial Trading in R

Adding indicators to charts

Recalculate indicators outside of strategy 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 with 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

Zoomed in

  • Use zoom_Chart("date1/date2") to get a closer look
  • zoom_Chart("2007-08/2007-12") results in:

Financial Trading in R

Let's practice!

Financial Trading in R

Preparing Video For Download...