Posts
Adam DrakeThe Efficient Market Hypothesis (EMH) is both important and often misunderstood. For our purposes, the term efficient is related to informational efficiency, or how quickly information affects prices. In a way, the level of informational efficiency in a market tells you what level of randomness to expect and consequently if it is possible to outperform the market. In its simplest form, the EMH states that market prices reflect decisions made by participants who have acted rationally based on information they possess.
...
read more Adam DrakeDon’t be fooled, this isn’t market commentary. This is commentary about market commentary. Many times when we come across market commentary, we see horrible examples of confusing correlation and causation, the logical fallacy of post hoc ergo propter hoc wherein event B is said to be caused by event A simply because event B followed A. This fallacy can be found in the vast majority of market commentary, and is especially obvious on days where the market didn’t move appreciably, yet there is someone claiming to know why the move occurred.
...
read more Adam DrakeI’ve been thinking recently about fractal geometry with applications to finance, and I talked to an acquaintance who informed me that he watches the “fractals” on his charts when trading. This prompted me to do some research into how technical analysts use “fractals” and see what kind of information such an indicator provides. There are many issues with using fractal behavior as a technical indicator, namely that the way the term is used in technical analysis doesn’t sound like it has anything to do with fractals at all.
...
read more Adam DrakeCompared to the Ruby version, computing this in R is much easier due to the built-in stochastic differential equation simulator. Assuming you have R installed, make sure you also install the sde package. Here is all the initial work that cleans up everything from your workspace, sets the initial value of the process, the end-point, how granular you want the simulation to be, and how many trajectories you want.
rm(list = ls(all = TRUE)) x0 = 50 end_point = 200 discretization_factor = 100 total_steps = end_point * discretization_factor #Use the same seed for multiple trajectories if (number_trajectories > 1) number_trajectories = 1 set.
...
read more Adam DrakeThis code is adapted from some Matlab code I found that simulates the OU process exactly. I had to code up a quick Gaussian random number generator in Ruby because I didn’t find a method to handle that. As noted in the comments I used the Box-Muller Transformation but if lots of random numbers are required the Ziggurat Algorithm could be used instead.
#!/usr/bin/env ruby include Math require 'rubygems' require 'gnuplot' #Gaussian random number generator using the Box-Muller Transformation #If this is too slow it can be replaced with the Ziggurat Algorithm def randn z1 = rand z2 = rand rand_normal = sqrt(-2.
...
read more