OPEN-SOURCE SCRIPT
Updated

Collatz Conjecture - DolphinTradeBot

279
1️⃣Overview

Every positive number follows its own unique path to reach 1 according to the Collatz rule.
Some numbers reach the end quickly and directly.
Others rise significantly before crashing down sharply.
Some get stuck within a certain range for a while before finally reaching 1.
Each number follows a different pattern — the number of steps it takes, how high it climbs, or which values it passes through cannot be predicted in advance.
This is a structure that appears chaotic but ultimately leads to order:
Every number reaches 1, but the way it gets there is entirely uncertain.

2️⃣How Is It Work?

  The rule is simple:
  ▪️If the number is even → divide it by two.
  ▪️If it’s odd → multiply it by three and add one.
  Repeat this process at each step.
Example :
 Let’s say the starting number is 7:
 7 → 22 → 11 → 34 → 17 → 52 → 26 → 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
 It reaches 1 in 17 steps.
 And from there, it always enters the same cycle:
 4 → 2 → 1 → 4 → 2 → 1...

3️⃣Why Is It Worth Learning?

🎯 This indicator isn’t just mathematical fun—it’s a thought experiment for those who dare to question market behavior.
 ▪️ It’s fun.
Watching numbers behave in unpredictable ways from a simple rule set is surprisingly enjoyable.
 ▪️ It shows how hard it is to teach a computer what randomness really is.
The Collatz process can be used to simulate chaotic behavior and may even inspire creative ways to introduce complexity into your code.
 ▪️ It makes you think — especially in financial markets.
The patternless, yet rule-based structure of Collatz can help train your mind to recognize that not all unpredictability is random. It’s a great mental model for navigating complex systems like price action.
 ▪️ Just like price movements in financial markets, this ancient problem remains unsolved.
Despite its simplicity, the Collatz conjecture has resisted proof for decades — a reminder that even the most basic-looking systems can hide deep complexity.

4️⃣How To Use?

Super easy — in the indicator’s settings, there’s just one input field.
Enter any positive number, and you’ll see the pattern it follows on its way to 1.
You can also observe how many steps it takes and which values it visits in the info box at the top center of the chart.

5️⃣Some Examples

You Can Observe the Chaos in the Following Examples⤵️
  For Input Number → 12
snapshot
  For Input Number → 13
snapshot
  For Input Number → 14
snapshot
  For Input Number → 32768
snapshot
  For Input Number → 47
snapshot
Release Notes
Chart Display Updated

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.