Algorithmic and Mechanical Forex Strategies | OneStepRemoved

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

QB Pro – May 2015

June 1, 2015 by Shaun Overton 7 Comments

April and May were a real swift kick in the teeth. There’s no hiding around the fact that the market wasn’t very nice to me or my trading accounts.

The vast majority of pairs in the portfolio blew out into major trends. That is bad news for a mean reversion strategy. When one currency trends, there are usually a handful bouncing around the mean. It gives us a chance to offset the losses. That didn’t happen recently, which is why my traders and I had a rough go of it.

I expect things to get better

Last month was bad enough that I completely ceased trading for two weeks. After turning the system back on in the second week of May, QB Pro continued to endure minor losses. That was thanks to one of the best trading decisions that I’ve made in the past year, which was to dramatically reduce the leverage.

The high risk account took a 6.2% loss. That would be very troublesome on a normal leverage account, but it’s a drop in the bucket by high risk standards. I look at it as more or less breaking even.

As a sign of my increased confidence, I increased my total deposits to $7,500 across the two accounts. As of today, the high risk account is back to trading on 20:1 leverage. It was at 5:1 for the past few weeks.

Changes to QB Pro

The signal to noise ratio contains enormous predictive power for my trades. I asked the question, “Does the signal to noise ratio at the time of entry predict the outcome of my QB Pro signals.

Judge for yourself.

Signal to noise ratio predicts returns of QB Pro

The signal to noise ratio predicts the returns of QB Pro

The first two dots to the left represent 82.62% of all the QB Pro signals. That’s the reason that the strategy makes money.

I use 1/2π as the barrier between a range and trend. When the SNR < 1/2π, the profit factor is 1.5 (very profitable). When the SNR > 1/2π, the profit factor drops to an atrocious 0.62.

Conclusion: only take trades if the SNR is in the good area. That’s exactly what the updated strategy is doing as of last Friday.

Based in part on experience and largely based on statistical analysis, I found a way to bend QB Pro into a historically profitable trending system on yen crosses. I’m sort of rushing this out the door because the market conditions are favorable. The accounts are trading USDJPY, EURJPY and GBPJPY on 1/3 of the overall portfolio. Perhaps I’m tapped out on the creativity front, but I’m calling this sub-strategy QB Yen.

Here’s a screenshot of the equity curve for USDJPY in MetaTrader. This was part of my quality control analysis to ensure that the signals generated at the proper times.

usdjpy-qbyen

I eventually want to analyze whether QB Yen can tolerate the spread costs of more exotic crosses like CADJPY. Until then, heavy weights will go on the most liquid yen crosses until it looks like they can handle the higher costs of the more exotic pairs.

QB Pro historically wins in 2 out of every 3 months. I don’t have enough data to judge whether consecutive losing months are dependent or independent, but it’s only happened twice historically where the system lost 3 months in a row. It’s never lost more than 3 consecutive months going all the way back to 2008.

QB Pro May 2015

Based on the new changes, the changing market conditions and the historical analysis of drawdowns, I feel much more comfortable putting more money into the account. For those of you that decided to take a break, I personally believe that the worst is over. The market will of course be the judge of that.

Filed Under: QB Pro Tagged With: digital signal processing, QB Pro, signal to noise ratio

The Power of Pi

April 26, 2015 by Shaun Overton 53 Comments

One of my favorite TV shows is Nova on PBS, which recently showed an hour long feature on the history of math. Now I know that would put most of you to sleep, but my initial reaction was, “Sweet!”.

Not two minutes into the show, the moderator starts discussing the number pi (π) and all the unusual places where it shows up. It’s not just the ratio of a circumference to the diameter of a circle. It shows up in statistics and, oddly enough, in the distance between a river’s path and its distance as the crow flies.

River distance pi

Look at the map of the Brisbane River above. The blue line is the river while the red line is the direct distance. If you take the distance that the blue line travels with all the wiggles and bends in the river, then divide it by the distance of the red line, you should get a ratio approximating π.

Will the ratio of the river exactly equal pi? No. But if you take the ratio of all rivers in the world, then average them together, you should get something pretty close to π.

Does this apply to forex?

The alarm bell immediately goes off in my head. “Whoa, maybe I can use that for trading!”

So, I made a mad dash for the office. I mean seriously, like a full on sprint 30 feet racing to get a pen and paper.

The idea for forex is a little different. It’s possible for the price not to go anywhere in 50 bars. It might move 0 pips.

If I used the river formula of walk/distance and the distance equals 0, bad things happen mathematically. I made a minor adjustment and decided to compare the distance/walk, the inverse. The expected outcome is now 1/π.

Analyze the Power of Pi in R

R is one of my favorite analysis platforms. If you’d like to the code that, you can download it.

Getting the price data is easy. Just go to MT4 and click File, Save. The currently selected chart can then save it’s data. The R code opens up the csv and does the analysis. Each list will look like this after processing the MT4 data.

Data example from R

The last step is to take the mean of the ratio column on the far right.

I started doing that for different currency pairs on H1 charts and found something odd

CurrencyTime FrameMean Ratio
EURUSDH10.1614123
AUDNZDH10.145748
GBPJPYH10.1587237
USDSEKDaily0.182126

 

1/π = 0.318
The average of the values in the table is 0.162.
1/2π = 0.159

Now we’re on to something interesting! The ratio of distance to movement or any given currency looks like it might be 1/2π. I’ve only analyzed a handful of charts so far. This isn’t conclusive, but it’s an interesting early observation.

Graphs

The this is for those of you more analytically inclined. The probability distribution frequency histograms of these very different currency pairs appear to have equal slopes,  if you normalize the frequency values.

audnzd pdf

EURUSD PDF

GBPJPY PDF

Digital Signal Processing

The more that I’ve thought about this idea, the more that I realize it’s a pure concept from digital signal processing (DSP).

Engineers analyze signals like this and call it the signal to noise ratio. The idea is simple – how much real information is contained within the observed data?

Using 1/2π as our assumed barrier, we now have a convenient way to categorize market conditions.

Ranging markets – the signal to noise ratio (SNR) <= 1/2π

Trending markets – SNR > 1/2π

I did a quick check in R using the code

range<- audnzd$ratio[audnzd$ratio <= limit]
length(range)/length(audnzd$ratio)
[1] 0.6083298

According to this rough guideline, the market ranges 60% of the time and trends 40% of the time. If I use 1/π as the barrier for a strong trend, the relative frequency drops to only 8%-12%, depending on the instrument.

Conclusion: If you wait for the SNR to reach the weak trend zone above 1/2π before accepting any trend trades, then approximately 1 in 5 trades should experience a significant trend.

The logic runs as follows:

  • 40% of the time is spent in a trend
  • 8-12% of the time is spent in a strong trend
  • 8/40 = 0.2, which is 20%. Strongly trending pairs may experience up to 30% significant trends.

How do you think we should use the SNR in a trading strategy? Share your ideas in the comments section below.

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: audnzd, digital signal processing, DSP, eurusd, gbpjpy, math, pi, ratio

Cumulant Ratio Indicator

October 17, 2013 by Shaun Overton 2 Comments

Coursera is one of my favorite sites online. Two weeks ago, I finally had the opportunity to register for the course that I’ve been waiting for: Digital Signal Processing.

Digital Signal Processing is used in everything from music to communications to… predicting financial markets. Although it’s not the focus of the class, I already drummed up a few ideas worth exploring as indicators.

The first indicator idea that the course inspired, and the one that I’m the most excited about, looks for bars that are out of place with their peers. I arbitrarily chose a lookback period of 20 for my analysis.

Steps to calculate the cumulant ratio:

  1. Calculate the average for periods 1-20
  2. Calculate the sum of the absolute value of Close of the bar – average for bars 1-20
  3. Calculate the sum of the Close of bar 0 (the last closed bar) – close of each bar, 1-20
  4. Divide step 3 by step 2

The initial result looked as expected. I placed the absolute value bars on step 2 so that I wouldn’t have to worry about the average changing the sign of the output. The top function is only positive if the current price is “above” the sum of the last 20 bars. A negative position means that the current price is “below”.

cumulant ratio indicator

Most markets are noise, which creates a natural noise band between ±1. Prices way out of line with the average show huge jumps like the one in the image.

Values around ±1 are expected. You wouldn’t, after all, expect a new bar to throw off the calculations very much.

That’s exactly the point. If something is near the ±1 window, then it’s probably worth ignoring. The price action is pure chop.

The real value is in the spikes. A spike of 20 isn’t any more important than a spike to 50. Above a certain threshold, the trader just needs to pay attention. It’s a black and white issue.

Strategy Ideas

My initial instinct was that the indicator would work well on emerging market currencies like TRY and ZAR. They’re so breakout prone that entering on the right side of the move, regardless of the reason, should do well.

It took about 20 minutes of chart gazing to come up with the strategy for the H4 chart. It was flat on most currencies, but USDZAR stood out. This equity curve used my initial settings without optimization. More importantly, the profit factor improved on a 1.5 year walk forward test.

Cumulant Ratio Strategy USDZAR

The breakout strategy did great on USDZAR H4 charts

The majors showed exactly the opposite. They do trend, but hardly in the mega-monster manner of the emerging markets. I modified the strategy to do the opposite and let ranging conditions prevail. EURUSD, as seems to be usual with range trading strategies, stood out as the best performer.

Cumulant Ratio EURUSD

The range trading approach works best on EURUSD H4

Nerd section

For the math nerds and programmers out there, the formula for the indicator is below.

cumulant ratio equation

The equation for the cumulant ratio

Filed Under: Trading strategy ideas Tagged With: Coursera, cumulative ratio, digital signal processing, emerging markets, eurusd, indicator, TRY, USDZAR, ZAR

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 © 2022 OneStepRemoved.com, Inc. All Rights Reserved.