Algorithmic trading has always been something I wanted to explore due to its potential as a passive income generating tool. The opportunity came when I received an email inviting students to join an algo trading competition. This was hosted by Algogene and the algorithm written was to be tested on IG's Demo Trading Platform.
At the point of writing, the strategy and algorithm I developed (with invaluable contributions by Wei Qi) has been running for a week. The performance was compromised due to some technical issues with the order size, but the strategy was still able to be implemented, achieving satisfactory results thus far (although it may have been unfairly biased by the abnormal growth of the US's currency strength during this period).
The strategy was relatively simple, I wanted an algorithm that could capture market momentum and find the points where an abnormally high momentum was sustained over a period of time. It turns out the relative strength index (RSI) was the exact indicator I was looking for to translate my idea into a quantity. The remaining parts of the project basically worked around supporting the core RSI strategy, providing alternative conditions to make trades and complementary orders to hedge against the RSI failing.
The core ideas are captured below:
(1) Understanding the RSI as a value that captures buy or sell momentum of an instrument (e.g. stock, ETF, FOREX), if the momentum is exceedingly high, it is indicative that the instrument has been overbought or oversold. The algorithm then makes a short or long call accordingly. The tricky part is determining what is the best threshold for a specific instrument.
(2) I identified that the strategy experiences critical failure when an instrument continuously increases or decreases in price in short spurts - just enough to cross the threshold to trigger a buy or sell order. To offset the losses from such trades, I implemented a regular savings plan (RSP) strategy based on thresholds that were between the RSI threshold and a neutral market state. Order sizes were scaled according to the momentum (i.e. if its near 0 momentum or the RSI thresholds, do almost nothing). The concept is illustrated in the diagram below:
(3) Wei Qi later found out that the moving average convergence divergence (MACD) was often used by traders to complement the RSI. Both are indicators of a price reversal, however they trigger on slightly different conditions. We had the option to choose whether to integrate both indicators to make a single decision or to let them make orders separately. Due to the lack of time, we developed both strategies in parallel and thus stuck with the latter option, hoping that they cancel each other's errors (and -fingers crossed- not each other's gains).
(4) Backtesting was used to quantitatively assess the performance of our algorithm and the different parameters we used for each decision (buy/sell volume, thresholds for decisions, periods etc.). I relied on a year with a generally incresing trend (2019) and a year with a decreasing trend (2018) for the instruments we intended to use (FOREX instruments that fluctuate significantly about a fixed point).
This first attempt at algorithm training has been both exciting and educational. At some later point in the future, I intend to deploy an improved algorithm (there is definitely ALOT OF ROOM for improvement) on a live account. You can find the report I wrote explaining the strategy in more detail using the GitHub link in the footer.