Category Algorithmic Trading

Moved to

I have moved my website/blog there to centralize my coding / quant finance postings, which is also the web site of my company KKB Research and Development (KKB is my initials).      

Optimizing the effective number of bets – an example using Canadian retail etfs

Hello all, It is Christmas time and that means family members wanting “stock market” advice. My usual response is not to do any analysis/advice for family members as I have a rather large extended family (by my last count over 100) and I just don’t think it’s appropriate. So I have worked up a quick […]

Effective Number of Bets of Risk Parity Strategies and Tactical Risk Parity by ENB

This post will aim to explore the effective number of bets ( of various risk parity strategies (   Why? Let’s see if it explains why some strategies outperform and others underperformed. If it is because we are not betting efficiently (ENB<Assets) relative to the other strategies it may indicate that a certain method or […]

Effective Number of Bets

Yesterday, I had a post on Risk Parity, however one of the drawbacks is if the assets are highly correlated the performance may not be the best. (¬† ). ¬† Today I will be analyzing the previous group from yesterday to see what was the effective number of bets. This is built off Attilio Meucci […]

Risk Parity using various risk measures (volatility, expected shortfall, semi deviation, maximum draw down)

A lot of people talk about equal risk contribution or balancing risk. This post aim’s to explore how a risk parity portfolio performs depending on the risk metric used in it’s calculation. I explore using Expected Shortfall. Volatility, Semi deviation and maximum drawdown as risk factors. The strategy is rebalanced monthly. Mathematically. Choose W such […]

Sixty-Forty rule

Quick blog post about the sixty forty rule rebalanced annually. As always this is not investment advice. Whipped it up using SPY for stocks and BND for bonds, I used adjusted closes, you could use closes or whatever you like, you can also change rebal to a different number of days. library(quantmod) library(PerformanceAnalytics) getSymbols(“SPY”) getSymbols(“BND”) […]

Trading on the Sharpe Ratio using quantstrat

The sharpe ratio can be viewed as a signal to noise ratio (when rf = 0), and this is a quick strategy to execute on “momentum” when the signal to noise ratio is appropriate, it appears to be profitable on the backtest. Here is quick example using the sharpe ratio to trade on. This is […]

AutoRegression (AR) Quanstrat Example

Made an example using a basic autoregressive process (lags chosen by Yule Walker equations). This is a proof of concept to show how to build a basic AR process that acts as a way to predict the market, I created a spread between model prediction and market. When the market shifts away from the “smoothed […]

Testing a Faberlike Timing Strategy on the SP500

Quantstrat version of a reddit post: Two rules: 1. Buy when SMA(10) > SMA(100) 2. Hold Cash Otherwise *** THIS IS NOT INVESTMENT ADVICE, I AM NOT YOUR BROKER, ADVISOR, FUND MANAGER OR HAVE ANY DUTY OF CARE, FIDUCIARY DUTY OR ANYTHING SIMILAR. I AM NOT LIABLE FOR ANY LOSSES *** As always Credit […]

A framework for building and testing strategies with getsymbols support (Long/Short)

I have made an update with getSymbols, so you can test out basic strategies, as always this is NOT investment advice and should not be used in implementation (don’t be crazy!).This is for demonstration purposes only!. This is long short, I used a basic indicator, N period moving average of the return, when it is […]