# The Bitcoin RoPE

## Introducing a robust non-parametric estimate for the likelihood of a return given the previous halving cycles closes, in a suspected cyclic market.

THIS IS NOT FINANCIAL ADVICE AND I AM NOT A LICENSED FINANCIAL ADVISOR THIS IS FOR ENTERTAINMENT PURPOSES ONLY.

WARNING: This is not financial advice. Trading can get you REKT very quickly. Only do it if you know what you are doing and have fully comprehended all of the tax and legal obligations and sought the advice of a licensed financial advisor.

**Please, if you enjoy my work don’t forget to either smash down the clap button or shoot us some sats at ****tippin.me**** or directly to my ****paynym ****— it really helps!**

# Abstract

In this article we make the case that there is a pattern to Bitcoin bull and bear markets that could be described as cycles. We employ fourier analysis to assist in the identification of and provide experimental evidence of the suspected cycles that have been hard coded into the Bitcoin code. We then utilise the prior cycles data to estimate a robust non parametric probability of the daily log returns for the current cycle.

# Introduction

The vision recurs; the Eastern sun has a second rise; history repeats her tale unconsciously, and goes off into a mystic rhyme; ages are prototypes of other ages, and the winding course of time brings us round to the same spot again.[1]

## Definitions

RoPE stands for Robust Probability Estimator. How is it “robust” exactly? It is robust strictly in the statistical sense — it is non parametric.

Parametric methods are based on statistical distributions, like the Normal distribution for instance. These distributions are described by functions and the functions have parameters. For example, the “standard” normal distribution has the parameters mean of 0, variance of 1 (tip: you might see this as **~N(0,1)**).

A “non” parametric method does not rely on distributions or distributional assumptions (to an extent!), and such does not rely on varying the parameters to any distribution.

Log Returns implies that an action is taken, here we have replaced this language with the more appropriate “log-deltas” i.e. the first differences of the log of the daily close prices.

# Method

*Cycles*

*Cycles*

The concept of cycles in Bitcoin markets is a common theme. Probably because there is a fundamental unchanging cycle in the Bitcoin code itself — the halving. Every 210000 blocks, the number of Bitcoin rewarded to the miners is cut in half.

This disinflation of the supply is a good part of why people believe there is a cycle to Bitcoin prices. The S2F model [3] for instance is based entirely on this fact (and ignores some pretty serious statistical flaws in the process [8]). Here we propose that part of the S2F model at least is correct — the halvings do mark the cycle end and beginning.

Assuming this is true, we might try to then calculate the maximum to minimum price ratios for each halving cycle.

A very simple power regression is fit — ln(percentage change) = -2.506 ln(halving) + 6.32793. You can see the curve fits nicely, however this is completely expected with only three points to use for the model. This graph says at the first halving, if you had managed to purchase at the minimum (non-zero) amount, and sell the exact top, you would have made just under 600x. For the second halving around 100x and for the last around 30x.

After the defeat of that mighty monarch, Mithridates, Gnaeus Pompeius found in his private cabinet a recipe for an antidote in his own handwriting; it was to the following effect: Take two dried walnuts, two figs, and twenty leaves of rue; pound them all together,

with the addition of a grain of salt; if a person takes this mixture fasting, he will be proof against all poisons for that day.[4]

We can now make the forecast that the maximum to minimum percent change for this cycle will be: exp(-2.506 ln(halving=4) + 6.32793) = 17.35. If we assume that we have already seen the minimum for this cycle (8,591), that translates to an expected maximum of $8,591 * 17.35 =$149,053.85. Now, **please take this with a grain of salt**

*—*we are talking about a model with three data points! That said, it seems to fit pretty well with other narratives.

## Ceteris paribus

For each cycle, we must make the assumption of ceteris paribus — (that is objectively incorrect, mind you) we must assume everything this cycle is as per the last. This enables us to view each cycle as a conitnuation of the last.

Let us assume that the percentage change is a direct consequence of the halving, and that log-deltas are an accurate enough representation of percentage change.

We must now establish whether the log-delta of the prices is stationary for each cycle. The stationarity enables us to transform our view of reality and transcend the roughness presented in the time domain. For the following analysis, the monthly closes have been used.

## Time and Frequency Domains

There is more than one view of the universe. Normally, we look at time series of financial markets in what is known as the time domain. The time domain is simple to relate to — it is a direct transcription of our own perception of reality. However, there is another way to view a time series — the frequency domain. This approach is known as Fourier analysis, and is commonly used in fields such as engineering, geophysics, and metrology. We now provide a brief introduction to Fourier analysis.

Assuming our data is stationary, we graph the time series 𝑌𝑡, and suppose there is evidence of periodic behaviour. Then a natural model for the time series is 𝑌𝑡=𝑅𝑐𝑜𝑠(𝜔𝑡+𝜃)where 𝑅 is the amplitude, 𝜔 is the frequency, and 𝜃 is the phase. This is a very simple model in the frequency domain with only one frequency.

In practice, a time series may have several different frequencies. For example, the data may have weekly, monthly, quarterly, yearly or longer frequencies. In other words, the data may show high, medium, and low frequencies. A natural extension of the model above that allows several frequencies is

Making use of the identity 𝑐𝑜𝑠(𝜔𝑡+𝜃)=𝑐𝑜𝑠𝜔𝑡𝑐𝑜𝑠𝜃−𝑠𝑖𝑛𝜔𝑡𝑠𝑖𝑛𝜃, we obtain

where 𝑎𝑗=𝑅𝑗𝑐𝑜𝑠 𝜃𝑗 and 𝑏𝑗=−𝑅𝑗𝑠𝑖𝑛 𝜃𝑗. This is known as the harmonic model. To simplify matters we work with frequencies in a range from –𝜋 to 𝜋. Without loss of generality, suppose that 𝜔𝑘=𝜋. Using the identity 𝑐𝑜𝑠𝜔+𝑖𝑠𝑖𝑛𝜔=𝑒^[𝑖𝜔] we obtain

where

are complex numbers for −𝑘<𝑗<𝑘

## Fourier Analysis of Bitcoin Monthly Closes

In the following, we have detrended the log transformed **monthly** close prices using a Hodrick-Prescott filter and conducted a Fourier analysis of the detrended transformed data. The monthly closes were chosen to reduce the error associated with random noise in the daily data.

Notice the peak at a frequency of about 0.021 cycles per month (cpm). The period is the reciprocal of frequency, and the reciprocal of 0.021 cpm is 48 months per cycle, or 4 years, approximating the halving schedule relatively closely (210000 blocks/6 blocks per hour/24 hours per day/365 days per year = 4 years). The other cycles in the periodogram should be the subject of future investigation.

## Robust Probability Estimator

This is not a prediction model. This is a risk model. Akin to Dilution Proof’s BPT[2], PlanB’s S2F[3] multiple or the Mayer Multiple. It only tells us where we are in the ocean, not where we might be going.

The number of times the log-delta (log-deltas being the first differences of the log transformed closes) has been at or above zero at the analogous location in the previous cycle, could be considered the likelihood of the current price to fall.

Without making any assumptions about the form of the distribution of the log-deltas (which we suspect is Cauchy anyway[6]), it is possible to estimate Pr(next log-delta>log-delta): the probability of exceeding the current log-delta.

An estimate of this probability is the count of previous log-deltas that are greater than the current log-deltas divided by the number of closes up until now. The binomial distribution can then be used to compute a one-sided lower confidence bound on this probability.

The method implemented below gives a two-sided lower 95% confidence bound on the probability of exceeding the current log-delta on a randomly selected day.

Using R as a calculator, a two-sided conservative 100(1 − α)% confidence interval for π is [π, π*] = [qbeta(α/2;x,n−x+1), qbeta(1−α/2;x+1,n−x)], where x is the number above and n is the number of log-deltas we have counted.

# Discussion

Now that we have established the technical details of the RoPE, we will establish the intuition. Imagine the RoPE as an actual rope, tied to the zero line of the log deltas. The rope can only stretch so far before it snaps taut and the delta comes back to it. Remember — the log deltas are essentially the percentage returns. This indicator thus gives you the capacity to estimate the risk of holding through a high return, or selling during a low one.

## Implementation

Below is a simple HTML/Javascript implementation of the Bitcoin RoPE indicator as described in the article above. The implementation requires internet access (to download the price data from coingecko).

<!--file name: bitcoinrope.html--><!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8"/>

<meta name="author" content="Btconometrics"><script src="https://cdn.jsdelivr.net/npm/jstat@latest/dist/jstat.min.js"></script>

<script src="https://cdn.plot.ly/plotly-1.5.0.min.js"></script>

<title>Bitcoin RoPE</title>

<script>function main(days, isf, divid, title) {

function diff(_x, by) {

var d= [];

for(i = by;i<_x.length;i++) {

d[i-by] = _x[i]-_x[i-by]

}

return d;

}function getRope(x,n, upper=true) {

if(upper) {

// qbeta(α/2;x,n−x+1)

return jStat.beta.inv( 0.025, x, n-x+1 );

} else {

// qbeta(1−α/2;x+1,n−x)

return jStat.beta.inv(1- 0.025, x+1, n-x );

}

}var xmlhttp = new XMLHttpRequest();

xmlhttp.onreadystatechange = function() {

var logdelta={y: [], x:[], name: 'log-delta', type: 'scatter', mode: 'lines'};

var rope={y: [], x:[], name: 'RoPE', type: 'scatter', yaxis: 'y2', mode: 'lines'};if (this.readyState == 4 && this.status == 200) {

var dateprice = JSON.parse(this.responseText);

var dateprices = dateprice.prices;var priceslog = dateprices.map(function(value,index) { return Math.log(value[1]); })

logdelta.y = diff(priceslog,1);

logdelta.x = dateprices.map(function(value,index) {

var d = new Date(value[0]);

var datestring = + d.getFullYear() +"-" + ("0"+(d.getMonth()+1)).slice(-2) +"-"+ ("0" + d.getDate()).slice(-2) + " " + ("0" + d.getHours()).slice(-2) + ":" + ("0" + d.getMinutes()).slice(-2)+ ":" + ("0" + d.getSeconds()).slice(-2)

return datestring });for(var i = 0; i< logdelta.y.length; i++){

var x = logdelta.y.slice(0,i).filter(counted => counted >= logdelta.y[i]).length;

if(logdelta.y[i]>0) {

rope.y.push(getRope(x+1,i+1,true));

} else {

rope.y.push(1-getRope(x+1,i+1,false));

}

}rope.x = dateprices.map(function(value,index) {

var d = new Date(value[0]);

var datestring = + d.getFullYear() +"-" + ("0"+(d.getMonth()+1)).slice(-2) +"-"+ ("0" + d.getDate()).slice(-2) + " " + ("0" + d.getHours()).slice(-2) + ":" + ("0" + d.getMinutes()).slice(-2)+ ":" + ("0" + d.getSeconds()).slice(-2)

return datestring });

}if (xmlhttp.readyState==4) {

if(!isf) {

updateplot(logdelta, rope, title);

}else {

newplot(logdelta, rope, title);

}

}

};xmlhttp.open("GET", "https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days="+days, true);

xmlhttp.send();function newplot(logdelta ,rope, ttl) {

var data = [logdelta, rope];

var layout = {

title: ttl,

yaxis: {title: 'Log-Delta'},

yaxis2: {

title: 'Prob(log-delta[n+1]>log-delta[n])',

titlefont: {color: 'rgb(148, 103, 189)'},

tickfont: {color: 'rgb(148, 103, 189)'},

overlaying: 'y',

side: 'right'

},

xaxis: {

type: 'date'

}

};

Plotly.newPlot(divid, data, layout)

}function updateplot(logdelta ,rope, ttl) {

var data = [logdelta, rope];

var layout = {

title: ttl,

yaxis: {title: 'Log-Delta'},

yaxis2: {

title: 'Prob(log-delta[n+1]>log-delta[n])',

titlefont: {color: 'rgb(148, 103, 189)'},

tickfont: {color: 'rgb(148, 103, 189)'},

overlaying: 'y',

side: 'right'

},

xaxis: {

type: 'date'

}

};

Plotly.newPlot(divid, data, layout)

}

}

main(1460, true, 'halvening', 'Halving Cycle');

setInterval(function(){main(1460, false,'halvening', 'Halving Cycle')},300000);</script>

</head>

<body>

<div id='halvening'></div>

</body>

</html>

**Please, if you enjoy my work don’t forget to either smash down the clap button or shoot us some sats at ****tippin.me**** or directly to my ****paynym ****— it really helps!**

# Addendum

In researching this article we discovered there is a correlation between the Bitcoin supply schedule and the USD valuation. This provides the first hint at a potential onchain metric for price forecasting.

# References

- 1845,
*The Christian Remembrancer*, Volume 10, (Book Review of “A History of the Church in Russia” by A. N. Mouravieff), Start Page 245, Quote Page 264, James Burns, Portman Street, London. - 2020, Dilution Proof,
*Introducing the Bitcoin Price Z-Score*, https://medium.com/swlh/introducing-the-bitcoin-price-z-score-edd3f80b7bf7 - 2019, PlanB.
*Modelling Bitcoins Value with Scarcity.*https://medium.com/@100trillionUSD/modeling-bitcoins-value-with-scarcity-91fa0fc03e25 - 77, Pliny the Elder,
*Historia naturalis* - 2020, Btconometrics,
*Bitcoin Daily Return Distribution*https://medium.com/coinmonks/bitcoin-daily-return-distribution-5b39ae14ba17 - 2012, Louis Liu, Eldon Paki, James Stonehouse, and Jing You,
*Cycle Identification: An old approach to (relatively) new statistics*, Paper presented at the 53rd New Zealand Association of Economists conference, at Palmerston North, New Zealand, 27 June 2012 - 2017, William Q. Meeker, Gerald J. Hahn, Luis A. Escobar,
*Statistical Intervals: A Guide for Practitioners and Researchers*, 2nd Edition ISBN: 978–0–471–68717–7 - 2020, Btconometrics,
*Stock-to-flow influences on Bitcoin price*, https://medium.com/coinmonks/stock-to-flow-influences-on-bitcoin-price-8a52e475c7a1

## Also, Read

- Crypto Trading Bots
- Uniswap API — How to get Uniswap data?
- AAX Exchange Review | Referral Code, Trading Fee, Pros and Cons
- Deribit Review | Options, Fees, APIs and Testnet
- FTX Crypto Exchange Review
- Bybit Exchange Review
- The Best Bitcoin Hardware wallet
- Crypto Copy Trading Platforms
- Bitsgap vs 3Commas vs Quadency
- The Best Crypto Tax Software
- Best Crypto Trading Platforms
- Best Crypto Lending Platforms
- Ledger Nano S vs Trezor one vs Trezor T vs Ledger Nano X
- BlockFi vs Celsius vs Hodlnaut
- Bitsgap review — A Crypto Trading Bot That Makes Easy Money
- Quadency Review- A Crypto Trading Bot Made For Professionals
- PrimeXBT Review | Leverage Trading, Fee and Covesting
- Altrady review
- Ellipal Titan Review
- SecuX Stone Review
- BlockFi Review | Earn up to 8.6% interests on your Crypto
- Best Crypto APIs for Developers
- Best Blockchain Analysis Tools
- Crypto arbitrage guide: How to make money as a beginner
- Top Bitcoin Node Providers
- Best Crypto Charting Tool
- What are the best books to learn about Bitcoin?