AmosTradingSystem

Correlation prix [SP500, TESLA, BTC

Before you see this post I want to thank all the TradingView team. Every day that passes I learn better and better to use Pine script and I owe this to all those who publish and to the philosophy of TradingView. Thanks from Amos

This trading indicator compares the prices of the S&P 500 Index (SP500), Tesla (TSLA), and Bitcoin (BTC) to find correlations between them. To make the prices of SP500 and Tesla comparable to the price of Bitcoin, the indicator multiplies the closing price of Tesla by 114 and the closing price of the S&P 500 Index by 5.6.
In this way we can superimpose the prices on the BTC chart and see what happens.

Average BTC price/ tesla price = 114, so if we multiply the tesla price by 114 times we can superimpose it on the BTC price
At average BTC/SPX price = 5.6, also in this case we multiply the price of SPX by 5.6 to overlay the graph and see any correlations.

The indicator then calculates the average price between SP500 and Tesla, using the formula (SP500 + Tesla) / 2. This calculation creates a new line on the chart that represents the average price between these two assets.
The BTC_SP_TE variable is then calculated as the average of the closing price of Bitcoin and the previously calculated average price of SP500 and Tesla, using the formula (Btc + SP_TE) / 2. This calculation creates another line on the chart that represents the average price between Bitcoin and the previously calculated average between SP500 and Tesla.

The idea behind calculating these averages is to find correlations and patterns between the prices of these assets, which can help identify potential trading opportunities. By comparing the average prices of different assets, the trader can look for trends and patterns that might not be apparent when looking at each asset individually.
The indicator plots these prices on a chart and fills the area between them with either green or fuchsia, depending on which one is higher. The strategy suggests buying Bitcoin when the average price of SP500 and Tesla is higher than the current price of Bitcoin, and selling when it is lower.
To add visual cues to the trading strategy, the indicator uses the plotchar function to display a small triangle below the chart when it detects a potential buying opportunity. This is done with the following parameters:

Value: BTC_SP_TE < Btc and Btc > Btc1 and Btc1 > Btc, which is a logical expression that checks whether the average price of SP500 and Tesla is less than the current price of Bitcoin (BTC_SP_TE < Btc), and whether the current price of Bitcoin is higher than the price 10 bars ago (Btc > Btc1) and higher than the price on the previous bar (Btc1 > Btc).
Text: "Moyen BTC_SP_Te", which is the text to display inside the marker.

Symbol: "▲", which is the symbol to use for the marker. In this case, it is a small triangle pointing upwards.

Location: location.belowbar, which specifies that the marker should be placed below the bar.


I hope this is an example of how to create an indicator on TradingView, remember that correlations do not always last, it is possible that when you see the graph this correspondence no longer exists, do your studies and get inspired.
开源脚本

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

免责声明

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

想在图表上使用此脚本?