Algorithmic and Mechanical Forex Strategies | OneStepRemoved

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

One line of code makes all the difference

February 9, 2017 by Shaun Overton 4 Comments

I was really excited about my Pilum strategy two months ago. The research looked great and everything was ready to rock and roll. Demo testing began and then… not much happened.

The Quantilator is (mostly) finished, which finally gave me time to circle back and review what happened with Pilum.

Live demo trading of Pilum

Live demo trading of Pilum. Dec 9, 2016 to Feb 7, 2017

The expected outcome was that I would win 75% of the time. Trades were infrequent, so I thought maybe I’m just having bad luck. But then my win rate remained stuck around 50%. Simple statistical tests told me this was unlikely to be bad luck.

I used the research time to pour over my research code and to compare it with live trades. What I found was that a single line of code (AHHHHHHHHHHHHHHH!) was incorrectly calculating my entry price, dramatically overstating the profits.

The flawed code produced this equity curve from a single combination of settings:
Flawed Pilum backtest

When the actual, correct result looks like this with those same settings:

The accurate backtest of Pilum

The accurate backtest of Pilum

I’ll be honest… I like the flawed backtest a lot more!

The new, single-setting backtest isn’t as good, but it’s still trade-worthy. There are some characteristics that I dislike and features that I love. Let’s dig into those.

What I dislike

The frequency of trades is very low. Out of 19 months there were a total of 43 trades. 43 trades to comprise a backtest on 40+ instruments is a very small number.

If it weren’t for the statistical pattern backing up the frequency, I would not consider the test. However, there are 20,000 bars each on the 44 instruments. There are 880,000 total bars used to analyze whether my Pilum pattern offers any predictive value.

The most valuable predictions, however, are also exceptionally rare. That’s why I’m not able to get the trading frequency higher, which would potentially smooth the returns.

What I love

My previous systems like QB Pro and Dominari traded actively for relatively small wins. Trading costs exercised a massive impact on the overall performance.

The accurate backtest of Pilum

The accurate backtest of Pilum

Now look again at the correct equity curve (the image to the right). Do you see the final profit of roughly 0.14? That’s a 14% unleveraged return over a 19 month period.

Allocating 2:1 or 3:1 leverage on this strategy could average annual returns of 15-25%.

Detecting hidden risk

A key measure of risk is skewness. You may not use that term yourself, but it’s something most of you already understand. The biggest complaint about people trading Dominari was that the average winner relative to the average loser was heavily skewed towards the losers.

Dominari wins on most months, but when it lost in December it was devastating. I implemented what I thought was a portfolio stop after the December 9th aftermath. Then I had a smaller, but still very painful, loss in January. The portfolio level stop loss of 3% should prevent future blowouts now that I know what goes wrong.

I still believe in Dominari. But, I obviously lost the work of most of the year due to those events.

Knowing that skewness is a good measure of blowout risk (even if you’ve never seen it in a backtest, like happened with Dominari), Pilum looks extremely encouraging.

This is a histogram of profit and loss by days. You should notice a few things.

The tallest bar is to the right of 0. That means that the most frequent outcome is winning.

worst and best days

The biggest winning day is dramatically better than the worst losing day. The worst outcome was a loss of 2%. The best outcome is gains near 10% in a single day (unleveraged!).

This is the statistical profile of an idea that’s much more likely to grab an avalanche of profits than it is to get blown out.

It gets even better

low correlation

Would you say that the blue and red equity curves are highly or loosely correlated? Look closely.

Writing this blog post made me think carefully about the Pilum strategy. I decided that maybe I should see if all of the profits are coming from different settings at the same time. There’s very little risk of overfitting the data as my strategy only has 1 degree of freedom.

The blue bars are the equity curve of Setting 1.

The red bars are for Setting 2.

Do you think these are tightly or loosely correlated?

If you said loosely correlated, then you are correct. Notice how each equity curve shows large jumps of profit. Did you notice how those profit jumps occur on different days?

The blue setting skyrockets on a single day in November 2016. It leaves the red equity curve choking in its dust.

But then, look what happens as I advance into December. The red curve dramatically catches up to the blue curve and even overtakes it.

The correlation between the 2 strategies is only 57%.

Combine multiple settings into 1 portfolio

Combined settings Pilum equity curve

This is a much nicer equity curve!

Loose correlations are a GIFT. Combining two bumpy equity curves into a single strategy makes the performance much, much smoother.

The percentages of days that are profitable also increases. Setting 1 is profitable on 58.0% of days. Setting 2 is profitable on 53.5% of days.

But… combining them makes Pilum profitable on 68.2% of days. Awesome!

That also provides more data, which puts me in a stronger position to analyze the strategy’s skewness. Look at the frequency histograms below. They’re the same type of histograms that I showed you in the first section of this blog post. As you’ll notice, they look a lot different.

Pilum most probable daily profit and loss

The most probable outcome for any given day is a small winner

The tall green bar is the most probable trading outcome for any given day with filled orders. The average day is a positive return of 0-1%.

The small red bar is the worst trading day of the combined strategy.

The small green bars are the best trading days of the combined strategy.

Look how far to the right the green bars go. The largest winner is more than 3x the biggest loss. And, there are so many more large winners compared to losers.

Giant winners are far more likely than comparable losses.

The Plan

I immediately pushed Pilum into live trading this combination of two strategies. I expect that adding a second degree of freedom and running about 30 different versions of the strategy – all with different settings – will add to the performance and smooth the returns even further.

Dominari hasn’t been working on my FXCM account, which is very difficult to accept because the lacking performance seems to be a buried execution issue. Pilum, however, trades very infrequently. It’s unlikely that execution quality will make a dramatic difference in the long term outcomes.

So, I’m going to convert the FXCM account to trading Pilum exclusively. That will be offered as a strategy on Collective2 within the next few weeks, a company with whom I’ve been working closely. Their users are more investor rather than trading oriented – they’re far more likely to view low trading frequency as a good thing. I suspect that most people here have a different opinion and want to see a lot of market action.

I’ll write an update on Dominari shortly.

Filed Under: Pilum, Trading strategy ideas Tagged With: correlation, curve fitting, degrees of freedom, Dominari, equity curve, frequency, FXCM, histogram, leverage, QB Pro, risk, skew, statistics

The guy that bet on Leicester City every year

September 5, 2016 by Shaun Overton Leave a Comment

Leicester City Football Club

Leicester City started the 2015 season with terrible odds of winning the Premier League Championship. Bookmakers only game them odds of 5,000:1 of winning.

To put that in context, you are more likely to die riding a bicycle than you were to win a bet on Leicester City. Or, you can think of betting on Leicester City every year. If you bet on them every single year for 5,000 years, you would expect them to win a grand total of… once.

2014 was hardly an indicator of their pending success. They were nearly relegated to a lower division (i.e., kicked out of the Premier League). And yet, they did win the championship last year.

Leicester City’s Biggest Fan

John Micklethwait

Meet John Michklethwait. He’s the former editor-in-cheif at The Economist and he’s currently editor-in-chief for Bloomberg. Clearly, he’s a very smart man. And yet, despite the odds and repeated disappointments, John bet on his old love, Leicester City, every single year dating back to the 1980s. That’s roughly 30 years of nonstop losing.

It wasn’t a lot of money each year: just £20. We all have our indulgences. I see the value of having skin in the game. £20 on a season is enough to make one care, but not so much that he’s upset about losing it.

Then something disruptive happened. John moved to the US last year for his position at Bloomberg. The chaos of the move threw him out of sorts, and he accidentally forgot to bet on Leicester City in 2015. He bet on them every single year dating back nearly 30 years. And yet the one year that he forgets to bet, not only did Leicester City win, but the bet paid out 5,000:1.

Let’s step back and calculate the cost of that oversight for Mr. Micklethwait.

£20 * 5,000 = £100,000.

A hundred… thousand… pounds. That kind of winning would put a nice dent in your mortgage, wouldn’t it?

The risk of low probability strategies

Everyone hears anecdotes about successful trend traders. Even winning only 30-40% of the time, they walk away big winners over time.

planet earth

You live HERE. Math isn’t good enough. You also need to wonder if your strategy can handle real-world problems.

What if they took that even lower? They could move their stop losses closer to the market. They’d reduce the size of the average loser, but the winning percentage might also drop to 10-20%.

Mathematically, this could work out identically. 30% winners that earn 5x the average loser make for a profit factor of 1.5. A strategy with only 10% winners that make 15x the typical loser also have a 1.5 profit factor.

Mathematically, this could work out identically. 30% winners that earn 5x the average loser make for a profit factor of 1.5. A strategy with only 10% winners that make 15x the typical loser also have a 1.5 profit factor.

They’re the same. Aren’t they?

Planet Earth isn’t the same as planet Math. In the real world, people get sick and miss trades. Or, they move across the Atlantic and forget to place a £20 bet.

People move. They get sick. Computers break. Things can and will go wrong with trading.

Richard Dennis once commented that the Turtle Traders would often make their annual returns off of one, single trade. A single trade!

When your performance depends on positive outliers, you’re massively vulnerable to accidents. What happens if you’re sick that day? Or your internet goes down? Or your broker locks you out of your account on the worst possible day?

Life happens, brother. A plan that depends on perfection is no plan at all. You need to make yourself robust to failure. Or even better, you’d make yourself antifragile.

Winning percentages

I mentioned that you can do really well winning 30-40% of time. Why then, does my own trading strategy, Dominari, win 68% of the time?

Because I’m exploiting compound, exponential growth. It’s not just how much you win, but the order in which you win it.

Let’s take two examples:

  1. A ranging strategy with a profit factor of 1.3 that wins 68% of the time.
  2. A trending strategy with a profit factor of 1.3 that wins 30% of the time.
Range vs trend outcomes

Look at the red circles. Trending strategies are prone to extreme outcomes, both positive and negative.

Each strategy risks about 1% on any given trade. And, the average of the range and trend strategies are identical in the long run.

But… and this is an important “but”, the expected worst case scenario with the trending strategy is substantially more likely compared to the range trading strategy. In effect, the average is more average with a ranging strategy than with a trending strategy.

Why is that? Because unusual losing streaks are devastating to trending strategies. Have you ever had a losing streak? It happens to everyone.

By using a strategy with a higher winning percentage, you’re making yourself robust to streaks of losers. And, not to mention, your average length of a winning streak is considerably higher.

Even though you’re getting the same mathematical outcome, you’re making things much easier on your trading psychology when you adopt a strategy with a higher winning percentage.

Dominari & Exponential Growth

Dominari backtest

You may have thought to yourself, “68%? That’s kind of a strange number to pick.”

You’d be right. The choice of 68% winners was not a coincidence. It is, in fact, the win rate on my Dominari strategy.

Dominari is about more than just buying and selling. Trading is also about managing a portfolio and position sizing. Position sizing is phenomenally important over your trading career.

My backtest results for Dominari show that for every $2,500, the account increased to $17,855.35 after 3 years. That kind of compound growth doesn’t happen by accident. That’s why I’d like to share the good news with you in my webinar this week.

I’m going to show you how to put that exponential awesomeness to work in your trading account. Sound good? Click here to register for the FREE webinar.

Filed Under: Dominari, How does the forex market work? Tagged With: antifragile, Dominari, profit factor, range trading, sports, trend, winning percentage

The Big Switch

February 1, 2016 by Shaun Overton 60 Comments

I moved all of my trading funds into Dominari this month.

I’ve been talking about this system ever since I start live demo testing back in November. Needless to say, I’ve been extremely satisfied with the live results.

My initial live account started trading on January 4 with a starting balance of €1,000 at Pepperstone. Once I saw that the live trades matched my expectations, I quickly kicked that account balance up to a total of €10,000.

And because I want to test the effect of broker selection, I threw another $5,000 in an FXCM account. The Pepperstone account contains the bulk of the money and runs the MT4 version of the strategy. The FXCM version uses Seer, which has been more of a pain to get running smoothly, though I can say that it’s still my favorite platform for testing ideas.

The cost non-problem

backtested equity curve

The equity curve of the Dominari without trading costs from 2013-2015.

My biggest concern about launching the strategy live was trading costs. Some back of the envelope math suggested that everything would be ok. Live demo testing indicated that it would be ok. But you never really know until you start trading live.

Through the month of January, I’ve consistently monitored the commissions relative to the profit. I fluctuates up and down with the trading account, but I estimate that the spread commission costs are approximately 20-25% of the profit. That’s a relatively high percentage, although it’s nowhere near as bad as it could be given the extreme trading frequency.

Dominari is a high-frequency strategy that averages about 49 trades per day on 28 currency pairs. Everything happens so fast in the account that I’m hard pressed to remember any individual trades. Dominari executed more than 900 trades in the month of January alone. It’s dizzying watching the equity fluctuate up and down. The important thing is that the trend moves from the lower left to the upper right.

QB Pro?

It’s not dead. I still believe it’s a great strategy and totally worthy of your trading. In fact, both Dominari and QB Pro depend critically on one of my favorite indicators, the SB Score.

The reason I got into algorithmic trading is that it emotionally separates me from the responsibility for the outcome. If I have a losing month, it’s just the strategy. There’s not much to do about that.

When there’s an element of discretion, it’s difficult to separate the random component. Sometimes you win, sometimes you lose, but you generally expect to make money. When there’s discretion in an algorithmic strategy, it’s very difficult to know whether losses are my fault or simple bad luck.

QB Pro depends on the manual portfolio selection. Not surprisingly, I heavily favor Dominari because the portfolio selection is static. I can say with my hand over my heart that Dominari is a black box, fully algorithmic strategy.

I’m still updating the portfolio over at Seer Hub and will continue making the selections for clients. For clients that are in the managed account at Pepperstone, I switched the strategy in the middle of the month. I feel responsible as the manager to give clients the best possible performance. And since that’s where I’m placing ~$16,000 of my own money, I feel a fiduciary duty to do the same for my customers. Dominari is where I believe the best opportunity lies.

How you can get Dominari

I plan to offer Dominari as trading signals to anyone with a MetaTrader account within the next month or so. A lot of hard work has gone into developing the strategy. And while I’m confident to the tune of $16,000 of my own money, I want to be even more certain before I release Dominari to a wider audience.

What do you think of the results so far? Leave your thoughts in the comments area below.

Filed Under: Dominari Tagged With: algorithmic trading, commission, Dominari, portfolio allocation, proprietary trading, spread

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.