本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator("Big Tick - Ticker & Timeframe Display", shorttitle = "Big Tick", overlay = true)
// ─── Inputs ────────────────────────────────────────────────────────────
grpPos = "Position"
posIn = input.string("Top Right", "Box location", group = grpPos,
options = ["Top Left", "Top Center", "Top Right",
"Middle Left", "Middle Center", "Middle Right",
"Bottom Left", "Bottom Center", "Bottom Right"])
grpTxt = "Text"
tickSz = input.string("Huge", "Ticker / timeframe size", group = grpTxt,
options = ["Tiny", "Small", "Normal", "Large", "Huge"])
descSz = input.string("Small", "Company name size", group = grpTxt,
options = ["Tiny", "Small", "Normal", "Large", "Huge"])
showDesc = input.bool(true, "Show company name", group = grpTxt)
showExch = input.bool(false, "Show exchange prefix (NASDAQ:NVDA)", group = grpTxt)
tfStyle = input.string("Chart (5, 60, 1D)", "Timeframe format", group = grpTxt,
options = ["Chart (5, 60, 1D)", "Friendly (5m, 1h, 1D)"])
sep = input.string(", ", "Separator between ticker and timeframe", group = grpTxt)
grpCol = "Colors"
tickCol = input.color(color.white, "Ticker text", group = grpCol)
descCol = input.color(color.new(#B2B5BE, 0), "Company name text", group = grpCol)
bgCol = input.color(color.new(#1E1E1E, 0), "Top background", group = grpCol)
descBg = input.color(color.new(#2A2A2A, 0), "Name background", group = grpCol)
brdCol = input.color(color.new(#555555, 0), "Border", group = grpCol)
brdW = input.int(1, "Border width", minval = 0, maxval = 5, group = grpCol)
// ─── Helpers ───────────────────────────────────────────────────────────
f_pos(string p) =>
switch p
"Top Left" => position.top_left
"Top Center" => position.top_center
"Top Right" => position.top_right
"Middle Left" => position.middle_left
"Middle Center" => position.middle_center
"Middle Right" => position.middle_right
"Bottom Left" => position.bottom_left
"Bottom Center" => position.bottom_center
=> position.bottom_right
f_size(string s) =>
switch s
"Tiny" => size.tiny
"Small" => size.small
"Normal" => size.normal
"Large" => size.large
=> size.huge
f_tf() =>
m = timeframe.multiplier
if tfStyle == "Chart (5, 60, 1D)"
timeframe.period
else
if timeframe.isseconds
str.tostring(m) + "s"
else if timeframe.isminutes
m % 60 == 0 ? str.tostring(m / 60) + "h" : str.tostring(m) + "m"
else if timeframe.isdaily
str.tostring(m) + "D"
else if timeframe.isweekly
str.tostring(m) + "W"
else if timeframe.ismonthly
str.tostring(m) + "M"
else
timeframe.period
// ─── Table ─────────────────────────────────────────────────────────────
var table box = table.new(f_pos(posIn), 1, 2, border_color = brdCol, border_width = brdW,
frame_color = brdCol, frame_width = brdW)
if barstate.islast
tkr = showExch ? syminfo.tickerid : syminfo.ticker
title = tkr + sep + f_tf()
table.cell(box, 0, 0, title, text_color = tickCol, bgcolor = bgCol,
text_size = f_size(tickSz), text_halign = text.align_center)
if showDesc
table.cell(box, 0, 1, syminfo.description, text_color = descCol, bgcolor = descBg,
text_size = f_size(descSz), text_halign = text.align_center)
else
table.clear(box, 0, 1)