Algorithmic and Mechanical Forex Strategies | OneStepRemoved

  • Articles
  • Sophisticated Web Sites
  • Automated Trading
  • Testimonials
  • Contact

Working 8 days a week

December 6, 2016 by Shaun Overton 22 Comments

Reaching an all-time high in my equity curve means it’s time to buckle down and keep improving. My Dominari strategy has done very well over the past 7 months and especially this and last month.

Dominari Equity Curve December 6, 2016

Is the party going to continue?

I certainly expect so. Drawdowns are inevitable, but that’s part of trading. Short-term performance is exciting, but my ambitious goal is to turn my starting balance of €8,000 into €50,000 within the next 3 years. As of this writing, I’m at €9,323.

You’re probably wondering how a 16% profit leads me to extrapolate an annual return of nearly 100%. The answer is that I dramatically changed my leverage at the end of September… just in time for that ugly drawdown. If I was trading on my current leverage, the current live return would be around 40% (i.e., right on track to hit my goal).

What really counts is what I’ve really done. So far, I’m up €1,323 with another €40,677 to go by December 6, 2019.

The research for Dominari is effectively finished. It’s been slightly more than a year since I began researching the strategy. Although minor variations of Dominari popped up or came from traders copying my signals, none of them improved the long term outcomes.

One version that improved the risk profile was to trade with limit orders. The original blog post mentioned limit orders, but the variation placed them considerably further from the current market than what I tried previously. I also lacked a system for choosing settings appropriate to every pair, which I’ve more than likely resolved. The problem is that I have a million things on my to-do list and only 8 hours a day. You’ll see some of my top projects when you scroll down.

Pilum: The latest and greatest

Pilum is a strategy based on a statistical process that identifies momentum. One of the scary elements about most quantitative strategies is that most of them are mean-reverting. They buy when the price drops and sell when the price rises. The approach is favorable (i.e., profitable) in the long run, but it takes some psychological fortitude to trade.

Pilum is a major advancement because now I’ll have a strategy that should profit exactly when Dominari is most vulnerable to a drawdown.

dominari trade outcome histogramThe new strategy uses limit orders to enter the market. Something like 90% of these orders never execute. But when they do execute, I win 75% of the time. Additionally, my profile of winners to losers is very comfortable.

Most traders understand the ideas even if the statistical jargon is unfamiliar. Pilum’s biggest winner is larger than its biggest loss. The average winner is bigger than the average loser. And, it wins 77% of the time.

Pilum trade outcome histogram

So far, I’ve done a sort of piecemeal backtest using R. When I finish the Quantilator (see below), I’ll redo the backtest in a fully fledged trading platform. More than likely, I’ll use QuantConnect to test the strategy level approach.

Trading platforms drive me crazy! The biggest problem that I have as a trader is continuously reallocating capital across my portfolio. MetaTrader, NinjaTrader and the likes implicitly assume that I want to trade some percentage of my account balance on every trade. Either that, or that I trade fixed lots.

Trading that way is extremely inefficient. I’m trying to trade 40+ currencies, so I need to be able to decide which ones need the money for trading and which ones don’t have signals. Then, among the ones that do have signals, I need to dish out their allocations proportionately. The allocations aren’t the same for each instrument. If you know of any good FX platforms that meet this requirement, then let me know in the comments section.

Testing Pilum on its own is important. More important than the performance of Pilum is how that performance interacts with Dominari. That means taking the daily equity values of each currency. Does Dominari lose when Pilum wins and vice versa? Should I allocate capital 50-50 between the strategies or does one strategy deserve the lion’s share of the portfolio? Is one strategy so good that it should get all of the money?

The main concern with portfolio allocation is how it relates to leverage. Dominari historically make 96% annual returns, inclusive of trading costs. But, it’s also trading with leverage of roughly 19:1. It’s possible for markets to rip over stops and create significant losses.

USDCHF lost 40% of its value in one hour in January 2015. Say that the scenario was even more extreme and that nobody could place a trade during that time at any price. That 40% move is multiplied by the 19x leverage used. That’s a theoretical 800% loss; more than the money in the account.

Everyone loves leverage because they think of profits. Leveraging losses is a lot less exciting.

So, if you could earn 96% annual returns and only use 5:1 leverage, that is exponentially superior to earning 96% on 19:1 leverage. I need to compare the returns of Pilum to Dominari per unit of risk. That allows me to do cool things like

  • Minimize the negative variance of the returns
  • Increase absolute return
  • Dynamically increase/decrease strategy allocations if I find patterns in their interactions

It’s a lower tech way of averaging strategies, like the litte guy’s version of what Numerai is doing… except that I have to create all of the strategies myself.

Quantilator

I spent the last few months sending surveys to segments of my subscribers asking how I can better serve you. Articles about indicators are overwhelmingly my most popular content. The trouble with that content is that I can’t complete the research fast enough to keep up.

The most valuable thing I’ve learned from the developing algorithms for the past 11 years is my process of deciding whether or not an indicator offers predictive value.

Moving Scale

Say that you’re interested in gaps: do gaps predict future returns? What I normally do is code a gap indicator in R, implement my analysis methodology and give a verdict. My methodology is kind of like a system for building systems. Using my approach usually takes an hour for every new idea that comes along.

An hour is pretty short. An hour is REALLY short compared to when I didn’t have a research methodology. I used to waste months on junk strategies.

With Quantilator, I’ll be able to analyze anything in under 5 minutes. I’ll only have to follow 3 steps:

  1. Run a script in MT4 to export price data and indicator data
  2. Upload the exported data to Quantilator
  3. Analyze the results

This tool will be 100% free. I’m planning to go through the most popular indicators in MetaTrader to analyze whether or not they offer an edge. I’m building a library of small edges that can be combined into powerful strategies like Dominari and Pilum. And, in the spirit of open source, I plan to make that library available to you for free.

I’m writing this tool in Django, which is a Python framework for displaying web content. The initial version will do the analysis. I’m hoping to use this as an education tool. A bit of momentum can justify make it a fully fledged library with sample data, indicators and training videos and more.

Quantilator’s name comes from a key concept in my system analysis methodology; I break data into quantiles. These quantiles calculate average market returns for a given period of time. The quant in Quantilator refers to quantiles, but I really like the implied double entendre of making you a quant. After all, that is what I’m doing for you!

Update: The Quantilator is now freely available at http://q.onestepremoved.com/

Filed Under: Dominari, Indicators, Test your concepts historically Tagged With: backtest, metatrader, portfolio allocation, portfolio systems, python, quant, QuantConnect, quantile

The Ivy Portfolio Allocation System

August 19, 2013 by Andrew Selby Leave a Comment

Most of the trading systems I have written about have been very similar. Each of the trend following systems attempt to capture big chunks of trends in similar ways. The mean reversion systems I have profiled each offer slightly different ways to execute the same basic mean reversion strategy. While each of these systems offer subtle differences in their approach, the general strategy is usually quite similar.

Of all the systems that I have looked at, the biggest outlier was George Vrba’s Best10 Portfolio Management System. This system wasn’t focused on trend following or mean reversion. It was simply trying to improve on a buy and hold approach to the general market. Because it was so different, this system has stuck out in the back of my mind as something I would love to explore further.

In my research and writing, I generally focus on very simple systems. The reason for this is that if a system is simple enough that my mother can understand the logic behind it, it may convince her to switch from her current buy and hope strategy. I believe that there is an huge market of investors, like my mother, who have no desire to trade for a living, but would love to have a simple way to steadily beat the general market.

The Ivy Portfolio

Last December, Jeff Swanson from System Trader Success wrote about The Ivy Portfolio, which is similar to Vrba’s Best10 System. Swanson’s work was based on a book written by Mebane Faber and Eric Richardson, who studied how Ivy League schools are able to achieve steady and significant returns on their endowment funds. Using what he learned from the book, Swanson built a similar system that would attempt to replicate how those schools are trading.

The concept of Swanson’s system is remarkably simple. He is taking a basket of 5 or 10 ETFs that represent a broad cross section of the market and investing in the ones with the highest relative strength. He formed a simple algorithm to calculate the relative strength of each ETF and then invests in the top three ETFs. He then calculates the relative strength and adjusts the portfolio each month. He also uses the 100 day simple moving average (SMA) as a trend filter to make sure that he is always trading with the trend.

The first step of the system is to rank each of the ETFs in terms of relative strength. Swanson does this by calculating the 20 day return and the three month return. This gives both shorter and longer term perspectives on each of the ETFs. He then weights each of the returns as half of the overall rank. Here is what his formula looks like:

Overall Rank = (20 Day Return * 0.5) + (3 Month Return * 0.5)

Each month, Swanson performs this calculation on each of the ETFs his system trades and then excludes any ETFs that are trading below their 100 Day SMA. He then adjusts his positions by selling any holding that does not rank in the top three positions. He then establishes a position in each of the top three ETFs, provided he does not already have a position in them. Each position accounts for 1/3 of the account equity.

Swanson proposes two different versions of this system. His Ivy Five system trades the following ETFs:

  • BND – Vanguard Total Bond Market
  • DBC – Powershares DB Commodity Index
  • VEU – Vanguard FTSE All-World ex-US
  • VNQ – Vanguard MSCI US REIT
  • VTI – Vanguard MSCI Total US Stock Market

He also proposed a bigger version of this system that trades these ten ETFs:

  • BND – Vanguard Total Bond Market
  • DBC – PowerShares DB Commodity Index
  • GSG – iShares S&P Commodity-Indexed Trust
  • RWX – SPDR DJ International Real Estate
  • TIP – iShares Barclays TIPS
  • VB – Vanguard MSCI US Small Cap
  • VEU – Vanguard FTSE All World ex-US
  • VNQ – Vanguard MSCI US REIT
  • VTI – Vanguard MSCI Total US Stock Market
  • VWO – Vanguard MSCI Emerging Markets

Backtesting Results

Swanson was able to backtest both systems from the middle of 2003 through the end of 2010. During that time, both versions outperformed the S&P 500 by a substantial amount with lower drawdowns. Being able to diversify away from equities and even stay completely out of the market at times gave these systems a tremendous advantage when the S&P 500 crashed in 2008.

Over the course of the backtesting period, the five ETF version of the system averaged an 11.8% annual return compared to only 7% for the S&P 500. The system had a maximum drawdown of 21.3% compared to 55.2% on the S&P 500. It also had a Sharpe Ratio of 0.72 compared to 0.29 on the S&P 500. As you can see, the Ivy Five System significantly outperformed a buy and hold approach with less than half the drawdown.

Since it had more options for diversification, the Ivy Ten System performed even better over the same time period. It averaged an annual return of 14.7%, had a maximum drawdown of -28.7%, and a Sharpe Ratio of 0.82. While the drawdown was a bit higher than the Ivy Five System, it was still way less than the S&P 500, and the overall return was better than the Ivy Five System.

System Analysis

The returns produced by the Ivy Systems are not as spectacular as the Best10 Returns were, but I would argue that the Ivy Systems are far more applicable for a part time trader. The systems also involve a much smaller universe, simpler calculations, and significantly less risk exposure.

These systems are easy to understand, appear to be profitable, and would be fairly simple to implement. Anyone with a high school math education could perform the required calculations and the process could be made even easier with a simple Excel spreadsheet.

My only reservation with these systems is the downside risk exposure that would exist in the event of a Black Swan market crash. If the bottom were to suddenly fall out of a market, I wouldn’t want the systems to wait until the end of the month to recalibrate and go to a cash position. This could be remedied by setting stop-losses at the 100 day SMA filter for all open positions.

Ranking Calculations Example

In order to demonstrate how to calculate the monthly rankings, I buildta simple Excel spreadsheet and looked up the price data for each of the 10 ETFs. I input the current price, the price from 20 trading days ago, and the price from 3 months ago. I also took a quick look at the chart of each ETF to see whether it was above or below the 100 day SMA line. I put a “Y” into the spreadsheet for each ETF that was above the line and an “N” for each ETF that was below the line. The rest was simple math to calculate the returns. Now that I have the Ivy spreadsheet built, the math will be done automatically from here on out.

ivy portfolio

Backtesting results of a portfolio with 10 ETFs

As you can see, five of the ETFs are currently above their 100 day SMA lines and the other five are below their 100 day lines. The five that are trading below their 100 day lines are automatically excluded from consideration. Interestingly, they were the bottom five in the overall ranking as well.

The top three ETFs in overall ranking are GSG, DBC, and VB. Therefore, if we were starting or reviewing an Ivy Ten portfolio this weekend, it would place one third of its equity into each of those three ETFs. Then we would repeat the same process next month.

Filed Under: Test your concepts historically, Trading strategy ideas Tagged With: ivy portfolio, portfolio systems

FREE trading strategies by email

Trending

Sorry. No data so far.

Archives

  • Dominari
  • How does the forex market work?
  • Indicators
  • MetaTrader Tips
  • MQL (for nerds)
  • NinjaTrader Tips
  • Pilum
  • QB Pro
  • Stop losing money
  • Test your concepts historically
  • Trading strategy ideas
  • Uncategorized
  • What's happening in the current markets?

Translation


Free Trading Strategies

Privacy PolicyRisk Disclosure

Copyright © 2023 OneStepRemoved.com, Inc. All Rights Reserved.