OPEN-SOURCE SCRIPT

Price DEFI Categories against BTC & ETH

Aggiornato
/* Work in progress. The indicator is not finished. *\

The indicator shows the pricing of 3 DEFI categories against 2 possible baselines, BTC and ETH.

To do:
* Make a simple array in the source code to enter and remove new projects to the category. -> Maybe can also make it so that the source code does not have to be altered (projects can be added through input etc.)
* Adjust weightings depending on project data but this is not as important since weightings are being priced in by the market.
* Try to find a way to update input to string instead of booleans. As of currently, I could not seem to use input strings into plot functions because of an error.
* and more. Leave some feedback, that would be highly appreciated!
Note di rilascio
V1.1

- Updated the title -> "DEFI against Majors" -> D.A.M 1.1
- Added subcategory 'Derivatives'
- Changed transparency (from 20 to 80) of the plot backgrounds
Note di rilascio
- Changed baseline default value to Ethereum
- Changed boolean input for baseline to choice between strings.
Note di rilascio
V1.2

- Updated user input. Added boolean (true/false) to give the option to disable certain categories.
- Added comments to the source code so it is easier to read for people that want to mess around with it.
Note di rilascio
V1.3

* Eco system mode
- Added most of the big DEFI projects from two spaces: Ethereum & Solana. I used the maps that can be found here: (https:// pentacle .ai)
- I chose to leave some out of the equation due to maturity of the chart; I can't really average a chart on 30 day lookback if it has just been listed 14 days capiche?

ETH DEFI SUPPORTED PROJECTS:
Compound, Harvest Finance, Yearn Finance, 0x, Aave, Badger DAO, Alpha Finance, Bancor Network, Curve Finance, Maker, Numeraire

SOL DEFI SUPPORTED PROJECTS:
Bonfida, Serum, Hxro


* Changed user input:
- Added seperators for convencience of sight/vision. Still debating whether I should leave or delete again.
- Added lookback (in days) as a reference point. Minimum value of 1 and maximum value of 30 days. On a lookback of 1 it is quite hard to react but you can spot new trends faster. Choose 30 lookback for a good overview of the last month. I advise to use inbetween 7 and 14 for optimal results.
- Added eco system mode which can be toggled on or off. Default value is off. What do you think? Should the indicator work from categories as a base or ecosystem as a base?
Note di rilascio
- Added new category 'liquid staking' containing LDO, FFXS, AANKR, RPL & STAFI
- Added ALPACA to the 'lending/borrowing' category
- Added GMX and DDYDX to the 'derivatives' category
- Added gradient coloring for better aesthetics :-)
- Fixed a bug where you could not disable single categories
Note di rilascio
  • Added a new function: In the newer version of the code, a new function named getSecurityData was added. This function takes two parameters, base and quote, and calculates the percentage change of the security (price) based on the provided parameters. This function is used to abstract away some of the repetitive code in the category calculations.
  • Modified baseline calculation: The baseline calculation was simplified by using the getSecurityData function for ETH against BTC and USD pairs. Previously, the calculation was done manually using security calls, but now it's done more efficiently with the new function.
  • Modified category calculations: The category calculations (e.g., Oracles, DEX, Lending/Borrowing, Derivatives, Liquid Staking) were updated to use the getSecurityData function instead of the previous security calls. This change reduced code duplication and made it easier to add new projects.
  • Refactored color handling in f_c_gradientAdvDec: The function f_c_gradientAdvDec now uses a new function f_colorNew to handle color and transparency calculations. This simplifies the code and improves readability.
  • Removed Eco mode related code: The older version of the code had an "Eco mode" option for showing the ecosystem plots. However, in the newer version, the "Eco mode" related code was removed, and only the ETH DEFI and SOL DEFI ecosystem calculations remain.
  • Updated plot visibility condition: The visibility conditions for each plot have been updated. In the newer version, plots are shown only when the corresponding category is enabled and the category_mode is also true. This allows users to toggle the visibility of individual categories.
  • Updated version number: The version number in the code has been updated to VERSION 1.5.
  • Updated comments and notes: The comments and notes were updated to reflect the changes and provide better clarity and instructions.


Overall, the newer version of the code introduces more abstraction through functions and improves the flexibility and maintainability of the indicator by allowing easier addition of new projects and better control over category visibility.
Note di rilascio

  • Upgraded to Pine Script v5: The script now takes advantage of the latest Pine Script features.
  • Baseline Security: The previous version only allowed for ETH or BTC as baseline securities. Now you can input any security as a baseline for comparison.
  • User-Selectable Categories: Enhanced user control over which categories to display. You can now toggle individual categories like Oracles, DEX, Lending/Borrowing, Derivatives, and Liquid Staking.
Bitcoin (Cryptocurrency)BTCdecentralizedfinanceDEFIETHEthereum (Cryptocurrency)SOLsolanaTrend Analysis

Script open-source

In pieno spirito TradingView, l'autore di questo script lo ha pubblicato open-source, in modo che i trader possano comprenderlo e verificarlo. Un saluto all'autore! È possibile utilizzarlo gratuitamente, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?


Anche su:

Declinazione di responsabilità