TJalam

Crypto Index Percentage Gain

TJalam 已更新   
This script calculates the percentage gain from the left-most visible candle for multiple cryptocurrency symbols and plots all of them on the chart.

Description:
The "Crypto Index Percentage Gain" indicator calculates the percentage gain from the left-most visible candle for a selection of cryptocurrency symbols. It utilizes the PineCoders VisibleChart library to access the high, low, close, and open prices of the visible chart range.

The user can customize the symbols to include in the calculation by enabling or disabling the corresponding input options. `_open` represents the open price, `_close` represents the close price, and `_gain` represents the calculated percentage gain. The formula used is (close - open) / open * 100 to calculate the percentage change between the open and close prices.

The calculated percentage gains for each symbol are plotted on the chart using different colors and line widths, providing an overview of the relative performance of the symbols.

Usage:

Add the "Crypto Index Percentage Gain" indicator to your trading view chart by searching it in indicator search bar or star it , it will show on your favourite indicators .
Configure the symbols and visibility options using the input parameters.
The indicator will calculate and display the percentage gain for each selected symbol based on the left-most visible candle on the chart.

Code Explanation:

The script imports the PineCoders VisibleChart library for accessing the visible chart range.
It defines a function `f_pcr()` to calculate the percentage gain for a given symbol.
Input options are provided to enable or disable symbols and set their visibility.
Symbols are defined using `input.symbol()` and the percentage gains are calculated using `request.security()`.
The calculated percentage gains for each symbol are plotted on the chart using different colors and line widths.

thanks to @PineCoders for VisibleChart library.
版本注释:
added comments

An enthusiast trader. I code my strategies in pine script.DM me for any Info.
Buy me coffee at:
paypal : tabrejalam786007@gmail.com
BTC : 15zY6PUsrV55UQvcfaSqk5hJexKZAwhpcK
TRC20: TPutH6FDYg6bJFF7xCjesp4n44qrMnizc7
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?