PROTECTED SOURCE SCRIPT

ICU AVG Line[MIT]

57
ICU AVG Line [MIT]
Overlay indicator (overlay=true), drawn directly on the price chart
Main Functionality:
Plots a dynamic line called “ICU Prediction Line” based on confirmed historical bars, representing a special form of “predicted central level”.
The line changes color in real-time based on the current price’s position relative to the ICU line:
Price above ICU → Green (bullish bias)
Price below ICU → Red (bearish bias)
  1. Uses only closed bar data for calculation, ensuring the line remains stable during the current open bar (no repainting or jumping).
  2. Displays a small label on the right side of the latest bar showing the current ICU value (“ICU: xxx.xx”), with color matching the line.
  3. Includes commented alert conditions (ready to enable):
  4. Price crosses above ICU → Potential buy signal
  5. Price crosses below ICU → Potential sell/exit signal

Visual Elements:
  1. Green/Red dynamic line: ICU Prediction Line (main line), width 2, broken line style, color flips based on price position.
  2. Small label: Shows current ICU value on the right of the latest bar, colored to match the line.
  3. Maximum 500 line segments preserved (max_lines_count=500) for smooth long-term chart performance.

Typical Usage Scenarios:
  1. Trend Following: Price consistently stays above the ICU line and the line is sloping upward → Strong bullish trend, consider holding long or adding.
  2. Dynamic Support/Resistance: ICU line often acts as moving support/resistance; multiple tests without breaking → Strong level.
  3. Crossover Signals: Price crosses above ICU from below (color turns green) → Potential bullish entry; crosses below (color turns red) → Potential bearish or exit signal.
  4. Range Filter: Price repeatedly crosses ICU with the line flattening → Choppy market, better to stay aside or scalp.

Parameter Description:
window: Default 5, controls smoothness and responsiveness of the ICU line. Larger values = smoother (better for swing/mid-term); smaller values = more sensitive (better for intraday).
主要功能:
  1. 在价格图表上绘制一条名为“ICU 预测线”的动态曲线,该曲线基于历史已确认K线数据计算得到,代表一种特殊的“预测中心位置”。
  2. 曲线颜色会根据当前价格与ICU线的相对位置实时变化:
  3. 价格在ICU线上方 → 绿色(偏多头)
  4. 价格在ICU线下方 → 红色(偏空头)
  5. 使用历史闭合数据计算,确保指标在未闭合K线期间保持稳定(不跳动),避免未来函数干扰。
  6. 在图表最后一根K线右侧显示实时数值标签(“ICU: xxx.xx”),方便快速查看预测值。
  7. 支持设置警报条件(已注释,可自行开启):
  8. 价格上穿ICU线 → 潜在买入信号
  9. 价格下穿ICU线 → 潜在卖出信号

图表呈现:
  1. 绿色/红色动态折线:ICU预测线(主线),宽度2,断线显示(style=plot.style_linebr),颜色随价格位置变化。
  2. 小标签:在最新K线右侧显示当前ICU数值,颜色与主线同步。
  3. 线条最多保留500段(max_lines_count=500),保证长期图表不卡顿。

使用场景建议:
  1. 趋势跟随:价格持续运行在ICU线上方且ICU线向上倾斜 → 强势多头,可考虑持多或加仓。
  2. 支撑/阻力参考:ICU线常作为动态支撑或阻力,价格多次测试不破 → 强支撑位。
  3. 穿越信号:价格从下方上穿ICU线(绿色变色)→ 多头启动信号;从上方下穿(红色变色)→ 空头启动或离场信号。
  4. 震荡过滤:价格在ICU线附近反复穿越且ICU线走平 → 震荡行情,适合观望或短线高抛低吸。

参数说明:
window(窗口长度):默认5,控制ICU线的平滑度和反应速度。数值越大越平滑,适合中长线;数值越小越敏感,适合短线。


Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.