Trading NYMEX (Crude Oil) Like a Quant: 55% Annual Return

Quant Daniel HaiStrategy for maximizing profits when trading a single commodity.

Author: Daniel Hai

While I strongly believe in good portfolio diversification I want to discuss trading a single commodity in this post, NYMEX Crude Oil futures which I Know First tracks as CL1 in the commodities forecast. The strategy is unique in that is uses the long term signal to trigger a decision; however the shortest term signal (3 Days) us used to actually execute it.

First of all the results are listed below. For testing, I use the QuantConnect Lean Engine, which is free and open (highly recommended). As they currently do not support futures I use the United States Oil ETF (USO).

results

The results are an annual return of 55.5% with a sharp ratio of 1.76 and an annual standard deviation of 22.3%. The total number of trades is 23, I attached the trade log here. The strategy really did a good job at capturing the decline in prices, rarely incurring any unnecessary losses. Below is the charted equity line of USO with my trades listed. Red down arrows indicate a negative algorithmic signal (and short) and green a positive (and long). Two red arrows in a row indicates a long position was first closed, and then a short position was opened.

Trading NYMEX

Perhaps an easier way to visualize the performance is through a weekly candle stick equity graph. As can be seen when the strategy actually made a loss during a week period it usually recovered that lost within the next week. Furthermore, sometimes all positions are closed, this is important as holding no position rather than a weak position based on guesses is better – always.

candlestick

Method

The strategy checks the algorithms mid-term signal (measure of pressure and direction) and compares it to the current market trend using a 5-day  moving average crossover. However, in this strategy I use a short term signal to actually execute the trade. What this means is that the algorithm could predict a short position in the long run and the market is trending up, yet the strategy will go short. The inverse is also true. Thus there are four situations in which I take a position.

Mid term signal is up – market is going up – short term signal is long – I go long

Mid term signal is up – market is going up – short term signal is short- I go short

Mid term signal is down – market is going down – short term signal is long – I go long

Mid term signal is down – market is going down – short term signal is short – I go short

It is really that simple, and with the algorithm’s signals at my disposal on a daily basis this becomes an easy systematic cash cow. You can easily code this trading into Quantconnect or Quantopean free of charge and have it run on auto pilot, or do it manually as 23 trades over a year is really not too demanding. However, in order to avoid back test bias or curve fitting I do want to share the results of trading only based on the moving average.

This model below simply trades according to the 5 day moving average cross. If the price is currently below the 5 day moving average than short, else long. Well as it happens the market tended to keep its direction and the results are certainly not bad with a net return of 25%; however, trade count is sharply up and all risk metrics are out the roof (annual deviation is higher than return).
badstrategy2stats badstrategy2line

So there you have it, trading with algorithmic signals and without. Please feel free to e-mail me directly ([email protected]) or I Know First ([email protected]) if you have any questions. If you are an annual commodities subscriber I will be happy to go through the exact implementation of the strategy with you.

Disclaimer: Neither I Know First nor the Author nor any of their data or information providers shall be liable for any errors in the data or information, or for any actions taken in reliance thereon.