OPEN-SOURCE SCRIPT
Diupdate Metallic Retracement Levels

There's something that's always bothered me about how traders use Fibonacci retracements. Everyone treats the golden ratio like it's the only game in town, but mathematically speaking, it's completely arbitrary. The golden ratio is just the first member of an infinite family of metallic means, and there's no particular reason why 1.618 should be special for markets when we have the silver ratio at 2.414, the bronze ratio at 3.303, and literally every other metallic mean extending to infinity. We just picked one and decided it was magical.
The metallic means are a sequence of mathematical constants that generalize the golden ratio. They're defined by the equation x² = kx + 1, where k is any positive integer. When k equals 1, you get the golden ratio. When k equals 2, you get the silver ratio. When k equals 3, you get bronze, and so on forever. Each metallic mean generates its own set of ratios through successive powers, just like how the golden ratio gives you 0.618, 0.382, 0.236 and so forth. The silver ratio produces a completely different set of retracement levels, as does bronze, as does any arbitrary metallic number you want to choose.
This indicator calculates these metallic means using the standard alpha and beta formulas. For any metallic number k, alpha equals (k + sqrt(k² + 4)) / 2, and we generate retracement ratios by raising alpha to various negative powers. The script algorithmically generates these levels instead of hardcoding them, which is how it should have been done from the start. It's genuinely silly that most fib tools just hardcode the ratios when the math to generate them is straightforward. Even worse, traditional fib retracements use 0.5 as a level, which isn't even a fibonacci ratio. It's just thrown in there because it seems like it should be important.
The indicator works by first detecting swing points using the Sylvain Zig-Zag. The zig-zag identifies significant price swings by combining percentage change with ATR adjustments, filtering out noise and connecting major pivot points. This is what drives the retracement levels. Once a new swing is confirmed, the script calculates the range between the last two pivot points and generates metallic retracement levels from the most recent swing low or high.
You can adjust which metallic number to use (golden, silver, bronze, or any positive integer), control how many power ratios to display above and below the 1.0 level, and set how many complete retracement cycles you want drawn. The levels extend from the swing point and show you where price might react based on whichever metallic mean you've selected. The zig-zag settings let you tune the sensitivity of swing detection through ATR period, ATR multiplier, percentage reversal, and additional absolute or tick-based reversal values.
What this really demonstrates is that retracement analysis is more flexible than most traders realize. There's no mathematical law that says markets must respect the golden ratio over any other metallic mean. They're all valid mathematical constructs with the same kind of recursive properties. By making this tool, I wanted to highlight that using fibonacci retracements involves an arbitrary choice, and maybe that choice should be more deliberate or at least tested against alternatives. You can experiment with different metallic numbers and see which ones seem to work better for your particular market or timeframe, or just use this to understand that the standard fib levels everyone uses aren't as fundamental as they appear.
The metallic means are a sequence of mathematical constants that generalize the golden ratio. They're defined by the equation x² = kx + 1, where k is any positive integer. When k equals 1, you get the golden ratio. When k equals 2, you get the silver ratio. When k equals 3, you get bronze, and so on forever. Each metallic mean generates its own set of ratios through successive powers, just like how the golden ratio gives you 0.618, 0.382, 0.236 and so forth. The silver ratio produces a completely different set of retracement levels, as does bronze, as does any arbitrary metallic number you want to choose.
This indicator calculates these metallic means using the standard alpha and beta formulas. For any metallic number k, alpha equals (k + sqrt(k² + 4)) / 2, and we generate retracement ratios by raising alpha to various negative powers. The script algorithmically generates these levels instead of hardcoding them, which is how it should have been done from the start. It's genuinely silly that most fib tools just hardcode the ratios when the math to generate them is straightforward. Even worse, traditional fib retracements use 0.5 as a level, which isn't even a fibonacci ratio. It's just thrown in there because it seems like it should be important.
The indicator works by first detecting swing points using the Sylvain Zig-Zag. The zig-zag identifies significant price swings by combining percentage change with ATR adjustments, filtering out noise and connecting major pivot points. This is what drives the retracement levels. Once a new swing is confirmed, the script calculates the range between the last two pivot points and generates metallic retracement levels from the most recent swing low or high.
You can adjust which metallic number to use (golden, silver, bronze, or any positive integer), control how many power ratios to display above and below the 1.0 level, and set how many complete retracement cycles you want drawn. The levels extend from the swing point and show you where price might react based on whichever metallic mean you've selected. The zig-zag settings let you tune the sensitivity of swing detection through ATR period, ATR multiplier, percentage reversal, and additional absolute or tick-based reversal values.
What this really demonstrates is that retracement analysis is more flexible than most traders realize. There's no mathematical law that says markets must respect the golden ratio over any other metallic mean. They're all valid mathematical constructs with the same kind of recursive properties. By making this tool, I wanted to highlight that using fibonacci retracements involves an arbitrary choice, and maybe that choice should be more deliberate or at least tested against alternatives. You can experiment with different metallic numbers and see which ones seem to work better for your particular market or timeframe, or just use this to understand that the standard fib levels everyone uses aren't as fundamental as they appear.
Catatan Rilis
Fixed max line/label issue.Fixed bar_index issue with lines.
Fixed issue with min ratio
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.