Quant Mashup - Dekalog Blog

Estimating the Bid-Ask Spread [Dekalog Blog]

Below I provide a vectorised Octave function to estimate the bid-ask spread from high, low and close prices according to "A Simple Way to Estimate Bid-Ask Spreads from Daily High and Low Prices," (Corwin and Schultz, 2012). The paper can be downloaded from one of the author's homepage

*- 1 month ago, 14 Dec 2018, 10:44am -*

A Bull Bear Background Plotting Function for Octave [Dekalog Blog]

As part of my recent research I have found it convenient to write another custom plotting function for Octave, which plots a single line price plot against a conditionally coloured background, e.g. two separate colours for bull and bear market regimes. Being able to plot like this avoids the

*- 3 months ago, 20 Oct 2018, 04:37am -*

"Black Swan" Data Cleaning [Dekalog Blog]

Since my last post I have been investigating training features that can be derived from my Currency Strength indicator as input for machine learning algorithms and during this work it was obvious that there are instances in the raw data that are Black Swan outliers. This can be seen in the chart

*- 3 months ago, 11 Oct 2018, 04:18pm -*

Update on Improved Currency Strength Indicator [Dekalog Blog]

Following on from my previous post I have now slightly changed the logic and coding behind the idea, which can be seen in the code snippet below Essentially the change simultaneously optimises, using Octave's fminunc function, for both the gold_x and all currency_x geometric multipliers

*- 7 months ago, 8 Jun 2018, 09:55am -*

An Improved Currency Strength Indicator plus Gold and Silver Indices? [Dekalog Blog]

In the past I have blogged about creating a currency strength indicator ( e.g. here, here and here ) and this post talks about a new twist on this idea. The motivation for this came about from looking at chart plots such as this, which shows Gold prices in the first row, Silver in the second and a

*- 7 months ago, 28 May 2018, 11:50am -*

Hidden Markov Modelling of Synthetic Periodic Time Series Data [Dekalog Blog]

I am currently working on a method of predicting/projecting cyclic price action, based upon John Ehlers' sinewave indicator code, and to test it I am using Octave's implementation of a Hidden Markov model in the Octave statistics package hosted at Sourceforge. Basically I measure the

*- 10 months ago, 3 Mar 2018, 01:36pm -*

Time Warp Edit Distance [Dekalog Blog]

Part of my normal routine is to indulge in online research for use useful ideas, and I recently came across An Empirical Evaluation of Similarity Measures for Time Series Classification, and one standout from this paper is the Time Warp Edit Distance where, from the conclusion, "...the TWED

*- 1 year ago, 11 Dec 2017, 10:14am -*

Candlestick Plotting Function for Octave [Dekalog Blog]

I have long been frustrated by the lack of an "out of the box" solution for plotting OHLC candlestick charts natively in Octave, the closest solution I know being the highlow plot function from the financial package ( which does not yet implement a candle function ) over at Octave

*- 1 year ago, 20 Nov 2017, 07:40am -*

Updating Historical Data Using Oanda's API and R [Dekalog Blog]

Following on from my previous post about downloading historical data, this post shows how previously downloaded data may be updated and appended with new, more recent data without having to re-download all the old data all over again. The main function to do this, HisPricesDates, downloads data

*- 1 year ago, 27 Oct 2017, 10:20am -*

Downloading Historical Data Using Oanda's API and R [Dekalog Blog]

It has been about 5 months since my last blog post and in this time I have been working away from home, been on summer holiday and spent some time mucking about on boats, so I have not been able to devote as much time to my blog as I would have liked. However, that has now changed, and this blog

*- 1 year ago, 22 Sep 2017, 10:16pm -*

Using the BayesOpt Library to Optimise my Planned Neural Net [Dekalog Blog]

Following on from my last post, I have recently been using the BayesOpt library to optimise my planned neural net, and this post is a brief outline, with code, of what I have been doing. My intent was to design a Nonlinear autoregressive exogenous model using my currency strength indicator as the

*- 1 year ago, 21 Apr 2017, 07:14pm -*

Preliminary Tests of Currency Strength Indicator [Dekalog Blog]

Since my last post on the currency strength indicator I have been conducting a series of basic randomisation tests to see if the indicator has better than random predictive ability. The first test was a random permutation test, as described in Aronson's Evidence Based Technical Analysis book,

*- 2 years ago, 8 Nov 2016, 08:33pm -*

Currency Strength Indicator [Dekalog Blog]

Over the last few weeks I have been looking into creating a currency strength indicator as input to a Nonlinear autoregressive exogenous model. This has involved a fair bit of online research and I have to say that compared to other technical analysis indicators there seems to be a paucity of pages

*- 2 years ago, 27 Oct 2016, 10:32am -*

Loading and Manipulating Historical Data From .csv Files [Dekalog Blog]

In my last post I said I was going to look at data wrangling my data, and this post outlines what I have done since then. My problem was that I have numerous csv files containing historical data with different date formats and frequency, e.g. tick level and hourly and daily OHLC, and in the past I

*- 2 years ago, 16 Sep 2016, 10:48am -*

Possible Addition of NARX Network to Conditional Restricted Boltzmann Machine [Dekalog Blog]

It has been over three months since my last post, due to working away from home for some of the summer, a summer holiday and moving home. However, during this time I have continued with my online reading and some new thinking about my conditional restricted boltzmann machine based trading system has

*- 2 years ago, 3 Sep 2016, 12:31pm -*

Giving Up on Recursive Sine Formula for Period Calculation [Dekalog Blog]

I have spent the last few weeks trying to get my recursive sine wave formula for period calculations to work, but try as I might I can only get it to do so under ideal theoretical conditions. Once any significant noise, trend or combination thereof is introduced the calculations explode and give

*- 2 years ago, 17 May 2016, 11:59am -*

Parallel Tempering and Adaptive Learning Rates in Restricted Boltzmann Machine Learning [Dekalog Blog]

It has been a while since my last post and in the intervening time I have been busy working on the code of my previous few posts. During the course of this I have noticed that there are some further improvements to be made in terms of robustness etc. inspired by this Master's thesis, Improved

*- 2 years ago, 31 Mar 2016, 03:11pm -*

Refactored Denoising Autoencoder Code Update [Dekalog Blog]

This code box contains updated code from my previous post. The main change is the inclusion of bias units for the directed auto-regressive weights and the visible to hidden weights. In addition there is code showing how data is pre-processed into batches/targets for the pre-training and code showing

*- 3 years ago, 22 Jan 2016, 03:41am -*

Recent Readings and New Directions [Dekalog Blog]

Since my last post I have been doing a fair bit of online research and fortunately I have discovered the following papers, which mesh nicely with what I am trying to do with Conditional Restricted Boltzmann Machines to model time series:- Deep Learning Architecture for Univariate Time Series

*- 3 years ago, 22 Nov 2015, 07:39pm -*

Giving up on Runge-Kutta Methods (for now?) [Dekalog Blog]

Over the last few weeks I have been looking at using Runge-Kutta methods for the creation of features, but I have decided to give up on this for now simply because I think I have found a better way to accomplish what I want. I was alerted to this possible approach by this post over at

*- 3 years ago, 13 Oct 2015, 03:38am -*

Runge-Kutta Example and Code [Dekalog Blog]

Following on from my last post I thought I would, as a first step, code up a "straightforward" Runge-Kutta function and show how to deal with the fact that there is no "magic mathematical formula" to calculate the slopes that are an integral part of Runge-Kutta. My approach is to

*- 3 years ago, 28 Sep 2015, 04:43am -*

Runge-Kutta Methods [Dekalog Blog]

As stated in my previous post I have been focusing on getting some meaningful features as possible inputs to my machine learning based trading system, and one of the possible ideas that has caught my attention is using Runge-Kutta methods to project ( otherwise known as "guessing" ) future

*- 3 years ago, 25 Sep 2015, 10:50am -*

Accounting for Data Mining Bias [Dekalog Blog]

I've recently subscribed to this forexfactory thread, which is about using machine learning to develop trading systems, and the subject of data mining/data dredging has come up. This post is a short description of how mining/dredging can be accounted for, but readers should be aware that the

*- 3 years ago, 25 May 2015, 01:57am -*

A Simple Visual Test of CRBM Performance [Dekalog Blog]

Following on from the successful C++ .oct coding of the Gaussian and Binary units, I thought I would conduct a simple visual test of the conditional restricted boltzmann machine, both as a test of the algorithm itself and of my coding of the .oct functions. For this I selected a

*- 3 years ago, 23 Apr 2015, 12:18pm -*

Optimised CRBM Code for Gaussian Units [Dekalog Blog]

Over the last few weeks I have been working on optimising the conditional restricted boltzmann machine code, with a view to speeding it up via a C++ .oct file, and in the code box below is this .oct code for the gaussian_crbm.m code in my previous post. This gaussian_crbm.m function, plus the

*- 3 years ago, 16 Apr 2015, 10:16pm -*

Conditional Restricted Boltzmann Machine [Dekalog Blog]

I have recently been looking at using a Conditional Restricted Boltzmann Machine, and in particular Graham Taylor's thesis paper, Composable Distributed-State Models for High-Dimensional Time Series and the associated code available from here. My adaptation of this is very much a work in

*- 3 years ago, 30 Mar 2015, 08:39pm -*

Particle Swarm Optimisation, Part 2 [Dekalog Blog]

Following on from my last post, here is an Octave .oct file implementation of the one dimensional Particle swarm optimisation routine, with one slight twist: instead of using a for loop I've implemented it within a while loop with a stopping condition that the algorithm should cease once there

*- 3 years ago, 1 Mar 2015, 09:38pm -*

Particle Swarm Optimisation [Dekalog Blog]

Having decided that I'm going to use my mfe_mae indicator as a target for my neural net, over the last couple of months I've been doing some research on what would make good features for this target. In the course of this I've also decided that Particle swarm optimization would be a

*- 3 years ago, 20 Feb 2015, 07:18pm -*