Quant Mashup - Dekalog Blog

Candlestick Pattern Scanner Functions [Dekalog Blog]

Since my last currency strength candlestick chart post it seemed to make sense to be able to scan said charts for signals, so below is the code for two Octave functions which act as candlestick pattern scanners. The code is fully vectorised and self-contained, and on my machine they can scan more

*- 1 month ago, 16 Aug 2020, 12:48pm -*

Forex Intraday Seasonality [Dekalog Blog]

Over the last week or so I have been reading about/investigating this post's title matter. Some quotes from various papers' abstracts on the matter are: "We provide empirical evidence that the unique signature of the FX market seasonality is indeed due to the different time zones

*- 2 months ago, 15 Jul 2020, 08:55pm -*

More Work on RVFL Networks [Dekalog Blog]

Back in November last year I posted about Random Vector Functional Link (RVFL) networks here and here. Since then, along with my recent work on Oanda's API Octave functions and Market/Volume Profile visualisation, I have continued looking at RVFL networks and this post is an update on this

*- 2 months ago, 18 Jun 2020, 09:47pm -*

Downloading FX Pairs via Oanda API to Calculate Currency Strength Indicator [Dekalog Blog]

In the past I have posted a series of blog posts about a Currency Strength Indicator (here, here, here and here). This blog post gives an Octave function to use Oanda's API to download all the 10 minute OHLC data required to calculate the above strength indicators on the 10 minute time frame.

*- 3 months ago, 7 Jun 2020, 11:12pm -*

An Improved Volume Profile Chart with Levels [Dekalog Blog]

Without much ado, here is the code ## Copyright (C) 2020 dekalog ## ## This program is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option)

*- 3 months ago, 21 May 2020, 10:26am -*

A Volume Profile With Levels Chart [Dekalog Blog]

Just a quick post to illustrate the latest of my ongoing chart iterations which combines a levels chart, as I have recently been posting about, but with the addition of a refined methodology of creating the horizontal histograms to more clearly represent the volumes over distinct periods. The main

*- 3 months ago, 19 May 2020, 10:30am -*

A Comparison of Charts [Dekalog Blog]

Earlier in May I posted about Market Profile with some charts and video. Further work on this has made me realise that my earlier post should more accurately be described as Volume Profile, so apologies to readers for that. Another, similar type of chart I have seen described as a TPO chart (TPO

*- 4 months ago, 18 May 2020, 11:08am -*

Market Profile Chart in Octave [Dekalog Blog]

In a comment on my previous post, visualising Oanda's orderbook, a reader called Darren suggested that I was over complicating things and should perhaps use a more established methodology, namely Market Profile. I had heard of Market Profile before Darren mentioned it, but had always assumed

*- 4 months ago, 4 May 2020, 09:26am -*

Visualising Oanda's Orderbook [Dekalog Blog]

My earlier post of 26th March shows code to visualise the most recent instantaneous snapshot of Oanda's order book, realised as a horizontal bar chart superimposed over a price chart. Below is a screen shot of a different type of chart designed to show the historical order book, which is

*- 4 months ago, 24 Apr 2020, 10:30am -*

Generic Octave_Oanda_API Function [Dekalog Blog]

My last two posts have shown Octave functions that use the Oanda API to access and download data. In the first of these posts I said that I would post more code for further functions as and when I write them. However, on further reflection this would be unnecessary as the generic form of any such

*- 5 months ago, 15 Apr 2020, 10:13pm -*

First Octave Function using Oanda API [Dekalog Blog]

As part of my on-going code revision I have written my first Octave function to use the Oanda API. This is just a simple "proof of concept" function which downloads an account summary. ## Copyright (C) 2020 dekalog ## ## This program is free software: you can redistribute it and/or modify

*- 5 months ago, 6 Apr 2020, 09:31am -*

Some Basic Code Housekeeping [Dekalog Blog]

Since my last post, back in late November last year, I have been doing a few disparate things such as: improving the coding of some functions in R to use the Oanda API to automatically download data using cronjobs coding some Octave functions to plot/visualise the above data more work on Random

*- 5 months ago, 29 Mar 2020, 12:27pm -*

Preliminary Results from Weight Agnostic Training [Dekalog Blog]

Following on from my last post, below is a selection of the typical resultant output from the Bayesopt Library minimisation 3 3 2 2 2 8 99 22 30 1 3 3 2 3 2 39 9 25 25 1 2 2 3 2 2 60 43 83 54 3 2 1 2 2 2 2 0 90 96 43 3 2 3 2 2 2 2 43 33 1 2 3 2 3 2 2 0 62 98 21 2 2 2 2 2 18 43 49 2 2 2 3 2 4 1 2 0

*- 10 months ago, 4 Nov 2019, 09:05am -*

Weight Agnostic Neural Net Training [Dekalog Blog]

I have recently come across the idea of weight agnostic neural net training and have implemented a crude version of this combined with the recent work I have been doing on Taken's Theorem ( see my posts here, here and here ) and using the statistical mechanics approach to creating synthetic

*- 10 months ago, 30 Oct 2019, 07:44pm -*

Another Method of Creating Synthetic Data [Dekalog Blog]

Over the years I have posted about several different methodologies for creating synthetic data and I have recently come across yet another one which readers may find useful. One of my first posts was Creation of Synthetic Data, which essentially is a random scrambling of historic data for a single

*- 11 months ago, 13 Oct 2019, 07:15pm -*

Ideal Cyclic Tau Embedding as Times Series Features [Dekalog Blog]

Continuing on from my Ideal Tau for Time Series Embedding post, I have now written an Octave function based on these ideas to produce features for time series modelling. The function outputs are two slightly different versions of features, examples of which are shown in the following two plots,

*- 11 months ago, 1 Oct 2019, 10:59pm -*

Preliminary Test Results of Time Series Embedding [Dekalog Blog]

Following on from my post yesterday, this post presents some preliminary results from the test I was running while writing yesterday's post. However, before I get to these results I would like to talk a bit about the hypothesis being tested. I had an inkling that the dominant cycle period might

*- 1 year ago, 5 Sep 2019, 12:46pm -*

Process Noise Covariance Matrix Q for a Kalman Filter [Dekalog Blog]

Since my last post I have been working on the process noise covariance matrix Q, with a view to optimising both the Q and R matrices for an Extended Kalman filter to model the cyclic component of price action as a Sine wave. However, my work to date has produced unsatisfactory results and I have

*- 1 year ago, 23 Jun 2019, 09:37pm -*

Determining the Noise Covariance Matrix R for a Kalman Filter [Dekalog Blog]

An important part of getting a Kalman filter to work well is tuning the process noise covariance matrix Q and the measurement noise covariance matrix R. This post is about obtaining the R matrix, with a post about the Q matrix to come in due course. In my last post about the alternative version

*- 1 year ago, 6 Jun 2019, 02:13pm -*

Extended Kalman Filter, Alternative Version [Dekalog Blog]

Below is alternative code for an Extended Kalman filter for a sine wave, which has 4 states: the sine wave value, the phase, the angular frequency and amplitude and measurements thereof. I have found it necessary to implement this version because I couldn't adjust my earlier version code to

*- 1 year ago, 31 May 2019, 03:03pm -*

Extended Kalman Filter [Dekalog Blog]

In the code box below I provide code for an Extended Kalman filter to model a sine wave. This is a mashup of code from a couple of toolboxes I have found online, namely learning-the-extended-kalman-filter and EKF/UKF Tollbox for Matlab/Octave. The modelled states are the phase, angular frequency and

*- 1 year ago, 27 May 2019, 01:59pm -*

Tests of Constant and Variable Acceleration Model Kalman Filters [Dekalog Blog]

In my last post I said that this next post would report the results of tests on a Constant Acceleration model Kalman filter, and the results are: fail, just like the Constant Velocity model, so I won't bore readers with reporting the details of the failed tests. However, tests of a Variable

*- 1 year ago, 5 Apr 2019, 11:38am -*

Test of Constant Velocity Model Kalman Filter [Dekalog Blog]

Following on from my previous post, this post is a more detailed description of the testing methodology to test kinematic motion models on financial time series. The rationale behind the test(s) which are described below is different from the usual backtesting in that the test(s) are to determine

*- 1 year ago, 1 Apr 2019, 09:40am -*

Revisiting the Kalman Filter [Dekalog Blog]

Some time ago ( here, here and here ) I posted about the Kalman filter and recently I have been looking at Kalman filters again because of this Trend Without Hiccups paper hosted at SSRN. I also came across this Estimation Lecture paper which provides MATLAB code for the testing of Kalman filters

*- 1 year ago, 21 Mar 2019, 09:02am -*

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 year 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

*- 1 year 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

*- 1 year 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

*- 2 years 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

*- 2 years 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

*- 2 years 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

*- 2 years 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

*- 2 years 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

*- 2 years 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

*- 2 years 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

*- 3 years 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,

*- 3 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

*- 3 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

*- 4 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

*- 4 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

*- 4 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

*- 4 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

*- 4 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

*- 4 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

*- 4 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

*- 4 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

*- 4 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

*- 5 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

*- 5 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

*- 5 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

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