OPEN-SOURCE SCRIPT
Crypto Trader Alert Data [FIXED]

//version=6
indicator("Crypto Trader Alert Data [FIXED]", overlay = true, max_labels_count = 500)
// —————— Входные параметры ——————
showLabels = input.bool(true, "Показывать метки?")
// —————— Расчет индикаторов ——————
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
rsiValue = ta.rsi(close, 14)
atrValue = ta.atr(14)
// Исправление для MACD - правильное получение гистограммы
[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
currentVolume = int(volume)
// Определяем тренд
trend = "neutral"
if ema20 > ema50 and ema50 > ema200
trend := "bullish"
else if ema20 < ema50 and ema50 < ema200
trend := "bearish"
// Уровни S/R (последние значимые экстремумы)
support = ta.lowest(low, 50)
resistance = ta.highest(high, 50)
// —————— Формирование JSON на последнем баре ——————
if barstate.islast
// Создаем JSON строку
json_string =
"{" +
"\"symbol\": \"" + syminfo.ticker + "\", " +
"\"price\": \"" + str.tostring(math.round_to_mintick(close)) + "\", " +
"\"trend\": \"" + trend + "\", " +
"\"interval\": \"" + timeframe.period + "\", " +
"\"rsi\": " + str.tostring(math.round(rsiValue, 2)) + ", " +
"\"macd_histogram\": " + str.tostring(math.round(histLine, 6)) + ", " +
"\"ema20\": " + str.tostring(math.round_to_mintick(ema20)) + ", " +
"\"ema50\": " + str.tostring(math.round_to_mintick(ema50)) + ", " +
"\"ema200\": " + str.tostring(math.round_to_mintick(ema200)) + ", " +
"\"atr\": " + str.tostring(math.round_to_mintick(atrValue)) + ", " +
"\"volume\": " + str.tostring(currentVolume) + ", " +
"\"support\": " + str.tostring(math.round_to_mintick(support)) + ", " +
"\"resistance\": " + str.tostring(math.round_to_mintick(resistance)) +
"}"
// Выводим метку для проверки
if showLabels
label.new(bar_index, high, text = json_string, style = label.style_label_down,
color = color.rgb(33, 150, 243), textcolor = color.white, size = size.small)
// Отправляем alert с JSON данными
alert(message = json_string, freq = alert.freq_once_per_bar_close)
indicator("Crypto Trader Alert Data [FIXED]", overlay = true, max_labels_count = 500)
// —————— Входные параметры ——————
showLabels = input.bool(true, "Показывать метки?")
// —————— Расчет индикаторов ——————
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
rsiValue = ta.rsi(close, 14)
atrValue = ta.atr(14)
// Исправление для MACD - правильное получение гистограммы
[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
currentVolume = int(volume)
// Определяем тренд
trend = "neutral"
if ema20 > ema50 and ema50 > ema200
trend := "bullish"
else if ema20 < ema50 and ema50 < ema200
trend := "bearish"
// Уровни S/R (последние значимые экстремумы)
support = ta.lowest(low, 50)
resistance = ta.highest(high, 50)
// —————— Формирование JSON на последнем баре ——————
if barstate.islast
// Создаем JSON строку
json_string =
"{" +
"\"symbol\": \"" + syminfo.ticker + "\", " +
"\"price\": \"" + str.tostring(math.round_to_mintick(close)) + "\", " +
"\"trend\": \"" + trend + "\", " +
"\"interval\": \"" + timeframe.period + "\", " +
"\"rsi\": " + str.tostring(math.round(rsiValue, 2)) + ", " +
"\"macd_histogram\": " + str.tostring(math.round(histLine, 6)) + ", " +
"\"ema20\": " + str.tostring(math.round_to_mintick(ema20)) + ", " +
"\"ema50\": " + str.tostring(math.round_to_mintick(ema50)) + ", " +
"\"ema200\": " + str.tostring(math.round_to_mintick(ema200)) + ", " +
"\"atr\": " + str.tostring(math.round_to_mintick(atrValue)) + ", " +
"\"volume\": " + str.tostring(currentVolume) + ", " +
"\"support\": " + str.tostring(math.round_to_mintick(support)) + ", " +
"\"resistance\": " + str.tostring(math.round_to_mintick(resistance)) +
"}"
// Выводим метку для проверки
if showLabels
label.new(bar_index, high, text = json_string, style = label.style_label_down,
color = color.rgb(33, 150, 243), textcolor = color.white, size = size.small)
// Отправляем alert с JSON данными
alert(message = json_string, freq = alert.freq_once_per_bar_close)
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
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.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
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.