Blog Archives

Stop Loss

July 29, 2013
By
Stop Loss

Today I want to share and present an example of the flexible Stop Loss functionality that I added to the Systematic Investor Toolbox. Let’s examine a simple Moving Average Crossover strategy: Buy is triggered once fast moving average crosses above the slow moving average Sell is triggered once fast moving average crosses below the slow

Read more »

Stochastic Oscillator

July 18, 2013
By
Stochastic Oscillator

I came across the link to the John Ehlers paper: Predictive Indicators for Effective Trading Strategies, while reading the Dekalog Blog. John Ehlers offers a different way to smooth prices and incorporate the new filter into the oscillator construction. Fortunately, the EasyLanguage code was also provided and i was able to translate it into R.

Read more »

Longer-history back-tests

July 11, 2013
By
Longer-history back-tests

One of the important steps of evaluating new trading idea or strategy is to see how it behaved historically (i.e. create back-test and examine the equity curve in different economic and market conditions) However, creating a long back-test is usually problematic because most ETFs do not have a long price history. One way to alleviate

Read more »

Update: Extending Commodity time series

July 3, 2013
By
Update: Extending Commodity time series

I showed an example of Extending Commodity time series back in 2012. Since then, the web site that I used to get the Thomson Reuters/Jefferies CRB Index data is no longer working. But there are a few alternatives: Thomson Reuters / Jefferies CRB Index. To get data, first select “TRJ/CRB Index-Total Return”, next click “See

Read more »

Loading Historical Stock Data

June 1, 2013
By
Loading Historical Stock Data

Historical Stock Data is critical for testing your investment strategies. I illustrated all my back-test examples with getSymbols function from quantmod package. For example, following is a back-test comparison for a few portfolio allocation methods: The getSymbols function, from quantmod package, downloads historical stock prices from Yahoo Fiance. I often get questions about alternative ways

Read more »

R/Finance 2013 slides

May 20, 2013
By
R/Finance 2013 slides

I have just returned from the R/Finance conference and want to share with you my slides and examples. The Cluster Risk Parity portfolio allocation method is an example of Cluster Portfolio Allocation methods that focuses on diversification or more specifically diversification of your risk bets. (i.e. portfolio that distributes risk equally both within clusters and

Read more »

Retirement : simulating wealth with random returns, inflation and withdrawals – Shiny web application

April 6, 2013
By
Retirement : simulating wealth with random returns, inflation and withdrawals – Shiny web application

Today, I want to share the Retirement : simulating wealth with random returns, inflation and withdrawals – Shiny web application (code at GitHub). This application was developed and contributed by Pierre Chretien, I only made minor updates. This is application is a great example of how easy it is to convert your R script into

Read more »

Maximum Sharpe Portfolio

March 21, 2013
By
Maximum Sharpe Portfolio

Maximum Sharpe Portfolio or Tangency Portfolio is a portfolio on the efficient frontier at the point where line drawn from the point (0, risk-free rate) is tangent to the efficient frontier. There is a great discussion about Maximum Sharpe Portfolio or Tangency Portfolio at quadprog optimization question. In general case, finding the Maximum Sharpe Portfolio

Read more »

Cluster Risk Parity back-test

March 4, 2013
By
Cluster Risk Parity back-test

In the Cluster Portfolio Allocation post, I have outlined the 3 steps to construct Cluster Risk Parity portfolio. At each rebalancing period: Create Clusters Allocate funds within each Cluster using Risk Parity Allocate funds across all Clusters using Risk Parity I created a helper function distribute.weights() function in strategy.r at github to automate these steps.

Read more »

Sector Rotation Back Test Shiny web application

February 18, 2013
By
Sector Rotation Back Test Shiny web application

Today, I want to share the Sector Rotation Back Test application (code at GitHub). This is the last application in the series of examples (I have shared 5 examples) that will demonstrate the amazing Shiny framework and Systematic Investor Toolbox to analyze stocks, make back-tests, and create summary reports. The motivation for this series of

Read more »