OPEN-SOURCE SCRIPT

Market Cap Landscape 3D

237
Hello, traders and creators! 👋

Market Cap Landscape 3D. This project is more than just a typical technical analysis tool; it's an exploration into what's possible when code meets artistry on the financial charts. It's a demonstration of how we can transcend flat, two-dimensional lines and step into a vibrant, three-dimensional world of data.

This project continues a journey that began with a previous 3D experiment, the T-Virus Sentiment, which you can explore here:
T-Virus Sentiment [hapharmonic]


The Market Cap Landscape 3D builds on that foundation, visualizing market data—particularly crypto market caps—as a dynamic 3D mountain range. The entire landscape is procedurally generated and rendered in real-time using the powerful drawing capabilities of polyline.new() and line.new(), pushed to their creative limits.

This work is intended as a guide and a design example for all developers, born from the spirit of learning and a deep love for understanding the Pine Script™ language.

---

🧐 Core Concept: How It Works

The indicator synthesizes multiple layers of information into a single, cohesive 3D scene:
  • The Surface: The mountain range itself is a procedurally generated 3D mesh. Its peaks and valleys create a rich, textured landscape that serves as the canvas for our data.
  • Crypto Data Integration: The core feature is its ability to fetch market cap data for a list of cryptocurrencies you provide. It then sorts them in descending order and strategically places them onto the 3D surface.
  • The Summit: The highest point on the mountain is reserved for the asset with the #1 market cap in your list, visually represented by a flag and a custom emblem.
  • The Mountain Labels: The other assets are distributed across the mountainside, with their rank determining their general elevation. This creates an intuitive visual hierarchy.
  • The Leaderboard Pole: For clarity, a dedicated pole in the back-right corner provides a clean, ranked list of the symbols and their market caps, ensuring the data is always easy to read.

---

🧐Example of adjusting the view

To evoke the feeling of flying over mountains
istantanea
istantanea

To evoke the feeling of looking at a mountain peak on a low plain
istantanea
istantanea

🧐Example of predefined colors
istantanea
istantanea
istantanea
istantanea
istantanea
istantanea
istantanea
istantanea
istantanea
istantanea
istantanea
istantanea
istantanea

---

🚀 How to Use

Getting started with the Market Cap Landscape 3D:
  1. Add to Chart: Apply the "Market Cap Landscape 3D" indicator to your active chart.
  2. Open Settings: Double-click anywhere on the 3D landscape or click the "Settings" icon next to the indicator's name.
  3. Customize Your Crypto List: The most important setting is in the Crypto Data tab. In the "Symbols" text area, enter a comma-separated list of the crypto tickers you want to visualize (e.g., BTC,ETH,SOL,XRP). The indicator supports up to 40 unique symbols.
    > Important Note: This indicator exclusively uses TradingView's `CRYPTOCAP` data source. To find valid symbols, use the main symbol search bar on your chart. Type `CRYPTOCAP:` (including the colon) and you will see a list of available options. For example, typing `CRYPTOCAP:BTC` will confirm that `BTC` is a valid ticker for the indicator's settings. Using symbols that do not exist in the `CRYPTOCAP` index will result in a script error. or, to display other symbols, simply type CRYPTOCAP: (including the colon) and you will see a list of available options.
  4. Adjust Your View: Use the settings in the Camera & Projection tab to rotate (Yaw), tilt (Pitch), and scale the landscape until you find a view you love.
  5. Explore & Customize: Play with the color palettes, flag design, and other settings to make the landscape truly your own!

---

⚙️ Settings & Customization

This indicator is highly customizable. Here’s a breakdown of what each setting does:


#### 🪙 Crypto Data
  • Symbols: Enter the crypto tickers you want to track, separated by commas. The script automatically handles duplicates and case-insensitivity.
  • Show Market Cap on Mountain: When checked, it displays the full market cap value next to the symbol on the mountain. When unchecked, it shows a cleaner look with just the symbol and a colored circle background.

#### 📷 Camera & Projection
  • Yaw (°): Rotates the camera view horizontally (side to side).
  • Pitch (°): Tilts the camera view vertically (up and down).
  • Scale X, Y, Z: Stretches or compresses the landscape in width, depth, and height, respectively. Fine-tune these to get the perfect perspective.

#### 🏞️ Grid / Surface
  • Grid X/Y resolution: Controls the detail level of the 3D mesh. Higher values create a smoother surface but may use more resources.
  • Fill surface strips: Toggles the beautiful color gradient on the surface.
  • Show wireframe lines: Toggles the visibility of the grid lines.
  • Show nodes (markers): Toggles the small dots at each grid intersection point.

#### 🏔️ Peaks / Mountains
  • Fill peaks volume: Draws vertical lines on high peaks, giving them a sense of volume.
  • Fill peaks surface: Draws a cross-hatch pattern on the surface of high peaks.
  • Peak height threshold: Defines the minimum height for a peak to receive the fill effect.
  • Peak fill color/density: Customizes the appearance of the fill lines.

#### 🚩 Flags (3D)
  • Show Flag on Summit: A master switch to show or hide the flag and emblem entirely.
  • Flag height, width, etc.: Provides full control over the dimensions and orientation of the flag on the highest peak.

#### 🎨 Color Palette
  • Base Gradient Palette: Choose from 13 stunning, pre-designed color themes for the landscape, from the classic SUNSET_WAVE to vibrant themes like NEON_DREAM and OCEANIC.

#### 🛡️ Emblem / Badge Controls
  • This section gives you granular control over every element of the custom emblem on the flag. Tweak rotation, offsets, and scale to design your unique logo.


---

👨‍💻 Developer's Corner: Modifying the Core Logic

If you're a developer and wish to customize the indicator's core data source, this section is for you. The script is designed to be modular, making it easy to change what data is being ranked and visualized.

The heart of the data retrieval and ranking logic is within the f_getSortedCryptoData() function. Here’s how you can modify it:

1. Changing the Data Source (from Market Cap to something else):

The current logic uses request.security("CRYPTOCAP:" + syms.get(i), ...) to fetch market capitalization data. To change this, you need to modify this line.
  • Example: Ranking by RSI (14) on the Daily timeframe.
    • First, you'll need a function to calculate RSI. Add this function to the script:
      Pine Script®
      f_getRSI(symbol, timeframe, length) => request.security(symbol, timeframe, ta.rsi(close, length))
    • Then, inside f_getSortedCryptoData(), find the `for` loop that populates the `caps` array and replace the `request.security` call:
      Pine Script®
      // OLD LINE: // caps.set(i, request.security("CRYPTOCAP:" + syms.get(i), timeframe.period, close)) // NEW LINE for RSI: // Note: You'll need to decide how to format the symbol name (e.g., "BINANCE:" + syms.get(i) + "USDT") caps.set(i, f_getRSI("BINANCE:" + syms.get(i) + "USDT", "D", 14))

2. Changing the Data Formatting:

The ranking values are formatted for display using the f_fmtCap() function, which currently formats large numbers into "M" (millions), "B" (billions), etc.
  • If you change the data source to something like RSI, you'll want to change the formatting. You can modify f_fmtCap() or create a new formatting function.
    • Example: Formatting for RSI.
      Pine Script®
      // Modify f_fmtCap or create f_fmtRSI f_fmtRSI(float v) => str.tostring(v, "#.##") // Simply format to two decimal places
    • Remember to update the calls to this function in the main drawing loop where the labels are created (e.g., str.format("{0}: {1}", crypto.symbol, f_fmtCap(crypto.cap))).

By modifying these key functions (f_getSortedCryptoData and f_fmtCap), you can adapt the Market Cap Landscape 3D to visualize and rank almost any dataset you can imagine, from technical indicators to fundamental data.

---

We hope you enjoy using the Market Cap Landscape 3D as much as we enjoyed creating it. Happy charting! ✨

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.