Indicator · Pine Script v4 · On the chart

BTC市场监控系统信号

by benzdriver

This indicator overlays external Bitcoin signal markers on the price chart.

View on GitHub

GitHub stars5on the repository
Pine versionv4older, still runs
Lines of code75
Settings2inputs
LicenceMIT
Last update1 year ago6 Mar 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

75 lines of Pine Script v4 from signals/btc_monitor_signals.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

btc_monitor_signals.pine

// BTC市场监控系统 - 外部信号指标
// 作者: AI_BTC_Trader
// 版本: 1.0
//@version=4
study("BTC市场监控系统信号", overlay=true)

// 配置项
signalServerUrl = input("http://localhost:7777", "信号服务器URL")
pollInterval = input(5, "轮询间隔 (分钟)")

// 计算轮询时间
timeChange = change(time("1"))
pollTime = timeChange != 0 and minute % pollInterval == 0

// 信号变量
var float signalStrength = 0.0
var float confidence = 0.0
var string decision = "观望"
var color signalColor = color.gray

// 处理信号
getSignal() =>
    signalStrength := 0.0
    confidence := 0.0
    decision := "观望"
    signalColor := color.gray
    
    // 这里使用策略的内置函数,无法在Pine Script中直接发HTTP请求
    // 实际使用时需要手动将latest_signal.json的数据输入到TradingView
    
    // 在实际使用中,有几种方法:
    // 1. 使用TradingView Alert Webhook功能(需要付费账户)
    // 2. 使用第三方服务如tradingview-webhooks
    // 3. 使用共享文件的方式(手动复制粘贴json数据)
    
    // 这里是模拟从外部获取信号
    if pollTime
        signalStrength := 0.0  // 在实际使用中,这里需要手动输入或通过webhook自动获取
        confidence := 0.0
        decision := "观望"
        
        // 根据信号设置颜色和标签
        if decision == "强力买入"
            signalColor := color.lime
        else if decision == "买入"
            signalColor := color.green
        else if decision == "卖出"
            signalColor := color.red
        else if decision == "强力卖出"
            signalColor := color.maroon
        else
            signalColor := color.gray

// 调用信号获取函数
getSignal()

// 绘制信号
plotshape(pollTime and decision == "强力买入", title="强力买入", location=location.belowbar, color=color.lime, style=shape.triangleup, size=size.large)
plotshape(pollTime and decision == "买入", title="买入", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.normal)
plotshape(pollTime and decision == "卖出", title="卖出", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.normal)
plotshape(pollTime and decision == "强力卖出", title="强力卖出", location=location.abovebar, color=color.maroon, style=shape.triangledown, size=size.large)

// 显示信号文本标签
var label signalLabel = na
label.delete(signalLabel)
if pollTime
    signalLabel := label.new(bar_index, high, 
                          text="信号: " + decision + "\n强度: " + tostring(signalStrength, "#.##") + "\n置信度: " + tostring(confidence*100, "#") + "%", 
                          color=signalColor, 
                          textcolor=color.white,
                          style=label.style_label_down)

// 显示当前信号状态
plotchar(true, "当前信号", "●", location.bottom, signalColor, size=size.tiny)

Overview

At a user-set minute poll interval it is meant to draw up or down triangles for buy and sell decisions and a label with the decision, strength and confidence. In the published code those values stay at zero and a wait state, so the trade shapes never appear, and comments state Pine Script cannot request the configured server. A small colored marker shows the current decision color along the bottom of the chart.

Details

Published by

benzdriver on GitHub

Type

Indicator, Pine Script v4

Draws

On the price chart

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
信号服务器URLstringhttp://localhost:7777signalServerUrl
轮询间隔 (分钟)int5pollInterval
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

948 stars

The Adaptive Laguerre Filter calculates a smoothed, dynamically adjusted trendline plotted directly on the main price chart. It dynamically adjusts its damping factor (alpha) based on recent price range variations and median percentile calculations over a spec

Indicator v4 TrendMoving averages
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive Laguerre Filter
575 stars

The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr

Indicator v6 SMC / ICT / price actionCandlestick patterns
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Displacement Candles Indicator
330 stars

This script plots three moving averages on the price chart: a fast EMA or SMA with 10 periods, a slow EMA or SMA with 20 periods, and a trend EMA or SMA with 100 periods. It signals trend changes by drawing a white cross when the fast moving average crosses ab

Indicator v4 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of 3 EMA/SMA + Cross [Alorse]
318 stars

This indicator calculates an ATR trailing stop line derived from the highest high minus an average true range multiple over a specified lookback period. It plots the trailing stop line directly on the price chart and colors price bars based on whether the clos

Indicator v5 TrendVolatility & bands
Updated 2 months ago · MIT GitHub repository of ATR Trailing Stoploss

1833 Tracker

by Allen1212
303 stars

1833 Tracker is an overlay indicator that visualizes historical buy and sell transactions executed by ARK Invest ETFs for the stock on the main price chart. It displays trade dates using green buy and red sell labels positioned relative to price bars, indicati

Indicator v4
Updated 2 years ago · None stated GitHub repository of 1833 Tracker

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers