OPEN-SOURCE SCRIPT

Crypto Divergence from BTC

This script is used to indicate when price action of a crypto coin is diverging significantly from that of BTC.

Explanation of the Script:
Inputs:

roc_length: The period used for calculating the Rate of Change.
ma_length: The period used for the moving average of the ROC.
threshold: The percentage difference that indicates a divergence.

Price Data:

The script retrieves the current asset's price and Bitcoin's price.
ROC Calculation:

The ROC for both the current asset and BTC is calculated based on the defined roc_length.
Moving Averages:

Simple moving averages (SMA) of the ROC values are calculated to smooth out the data.
Divergence Detection:

The indicator checks if the current asset's ROC MA is significantly higher or lower than Bitcoin's ROC MA based on the specified threshold.
Plotting:

The script plots the ROC values and their moving averages.
It also highlights the background in green when a bullish divergence is detected (when the asset is moving up while BTC is lagging) and in red for a bearish divergence.
Simple Moving Average (SMA)

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

チャートでこのスクリプトを利用したいですか?

免責事項