Nova on PBS 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.
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
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.
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
|CURRENCY||TIME FRAME||MEAN RATIO|
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.
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.
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)
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.