本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//@version=6
indicator("Prop Firm Daily Reset Lines", shorttitle = "Prop Reset", overlay = true, max_lines_count = 500, max_labels_count = 500)
// Draws a vertical line where a crypto prop firm's trading day starts, i.e. where
// the daily loss limit resets. Reset times are taken from each firm's published
// rules and were last checked on 19 Oct 2026. Rules change: check your firm's
// rulebook before you rely on a time.
//
// Firms whose clock moves with daylight saving time are calculated in that
// time zone, so the lines move by one hour on the right date by themselves.
// ───── Firms ─────
const string F_HYRO = "HyroTrader"
const string F_PROPR = "Propr"
const string F_CFT = "Crypto Fund Trader"
const string F_KRAKEN = "Kraken Prop"
const string F_BREAK = "Breakout"
const string F_VELO = "Velotrade"
const string F_E8 = "E8 Markets"
const string F_BRIGHT = "BrightFunded"
const string F_BITF = "Bitfunded"
const string F_CUSTOM = "Custom"
const string E8_NY = "Server clock UTC+3 / UTC+2 (17:00 New York)"
const string E8_P3 = "Fixed UTC+3"
const string E8_P2 = "Fixed UTC+2"
const string BF_LOCAL = "Amsterdam local time (CET / CEST)"
const string BF_FIXED = "Fixed CET (UTC+1) all year"
// ───── Inputs ─────
string firmIn = input.string(F_HYRO, "Firm", options = [F_HYRO, F_PROPR, F_CFT, F_KRAKEN, F_BREAK, F_VELO, F_E8, F_BRIGHT, F_BITF, F_CUSTOM])
bool compare = input.bool(false, "Show all 9 firms", tooltip = "One colored line per firm. Useful if you trade at several firms.", display = display.none)
string GR_C = "Custom firm"
int cHour = input.int(0, "Reset hour", minval = 0, maxval = 23, group = GR_C, display = display.none)
int cMin = input.int(0, "Reset minute", minval = 0, maxval = 59, group = GR_C, display = display.none)
string cTz = input.string("UTC", "Time zone", group = GR_C, tooltip = "Examples: UTC, UTC+8, Europe/London, America/New_York", display = display.none)
string cName = input.string("My firm", "Name on chart", group = GR_C, display = display.none)
string GR_K = "Clock details"
string e8Mode = input.string(E8_NY, "E8 server clock", options = [E8_NY, E8_P3, E8_P2], group = GR_K, tooltip = "E8 resets at 00:00 server time. The server runs on UTC+3 and moves to UTC+2 in early November, back to UTC+3 in March. The default follows that switch (00:00 server = 17:00 New York).", display = display.none)
string bfMode = input.string(BF_LOCAL, "BrightFunded '23:30 CET' means", options = [BF_LOCAL, BF_FIXED], group = GR_K, tooltip = "BrightFunded resets between 23:30 and 23:59 CET. From late October to late March both options give the same time (22:30 UTC). They differ only in summer.", display = display.none)
string GR_S = "Style"
color lineCol = input.color(color.new(#E5484D, 0), "Line color", group = GR_S, display = display.none)
string styleIn = input.string("Dashed", "Line style", options = ["Solid", "Dashed", "Dotted"], group = GR_S, display = display.none)
int widthIn = input.int(1, "Line width", minval = 1, maxval = 4, group = GR_S, display = display.none)
bool showLbl = input.bool(true, "Label on each line (single firm)", group = GR_S, display = display.none)
bool showTbl = input.bool(true, "Show countdown table", group = GR_S, display = display.none)
string posIn = input.string("Top right", "Table position", options = ["Top right", "Top left", "Bottom right", "Bottom left"], group = GR_S, display = display.none)
// ───── Firm data ─────
resetTz(string f) =>
string tz = "UTC"
if f == F_BITF
tz := "UTC+8"
else if f == F_E8
tz := e8Mode == E8_NY ? "America/New_York" : e8Mode == E8_P3 ? "UTC+3" : "UTC+2"
else if f == F_BRIGHT
tz := bfMode == BF_LOCAL ? "Europe/Amsterdam" : "UTC+1"
else if f == F_CUSTOM
tz := cTz
tz
resetHour(string f) =>
int h = 0
if f == F_E8 and e8Mode == E8_NY
h := 17
else if f == F_BRIGHT
h := 23
else if f == F_CUSTOM
h := cHour
h
resetMin(string f) =>
int m = 0
if f == F_CFT
m := 5
else if f == F_KRAKEN or f == F_BREAK or f == F_VELO or f == F_BRIGHT
m := 30
else if f == F_CUSTOM
m := cMin
m
firmName(string f) =>
f == F_CUSTOM ? cName : f
// Reset moment on the calendar day that contains time t (in the firm's time zone).
resetOn(string f, int t) =>
string tz = resetTz(f)
timestamp(tz, year(t, tz), month(t, tz), dayofmonth(t, tz), resetHour(f), resetMin(f), 0)
// Reset moment that falls inside the current bar, or na.
resetInBar(string f) =>
int r = na
if not na(time_close)
int r1 = resetOn(f, time)
int r2 = resetOn(f, time_close - 1)
if r1 >= time and r1 < time_close
r := r1
else if r2 >= time and r2 < time_close
r := r2
r
// Next reset after now. Steps of 12 hours so a 23-hour DST day can't be skipped.
nextReset(string f) =>
int best = na
for i = 0 to 3
int r = resetOn(f, timenow + i * 43200000)
if r > timenow and (na(best) or r < best)
best := r
best
lineStyle() =>
styleIn == "Solid" ? line.style_solid : styleIn == "Dotted" ? line.style_dotted : line.style_dashed
leftText(int ms) =>
int mins = int(math.floor(ms / 60000.0))
str.tostring(int(math.floor(mins / 60.0))) + "h " + str.tostring(mins % 60) + "m"
// ───── Drawing ─────
var firms = array.from(F_HYRO, F_PROPR, F_CFT, F_KRAKEN, F_BREAK, F_VELO, F_E8, F_BRIGHT, F_BITF)
var colors = array.from(#E5484D, #F76B15, #FFC53D, #46A758, #12A594, #0090FF, #8E4EC6, #D6409F, #8D8D8D)
drawReset(string f, color c, bool withLabel) =>
int r = resetInBar(f)
if not na(r)
line.new(r, low, r, high, xloc = xloc.bar_time, extend = extend.both, color = c, style = lineStyle(), width = widthIn)
if withLabel
string txt = f == F_BRIGHT ? "BrightFunded rollover (23:30–23:59 CET)" : firmName(f) + " · new day"
label.new(r, high, txt, xloc = xloc.bar_time, yloc = yloc.abovebar, color = color.new(c, 0), style = label.style_label_down, textcolor = color.white, size = size.small)
if timeframe.isintraday
if compare
for [i, f] in firms
drawReset(f, array.get(colors, i), false)
else
drawReset(firmIn, lineCol, showLbl)
// ───── Countdown table ─────
tablePos() =>
posIn == "Top left" ? position.top_left : posIn == "Bottom right" ? position.bottom_right : posIn == "Bottom left" ? position.bottom_left : position.top_right
var table tb = table.new(tablePos(), 3, 12, bgcolor = color.new(color.black, 15), border_width = 1, border_color = color.new(color.gray, 70))
addRow(int row, string f, color c) =>
int nr = nextReset(f)
table.cell(tb, 0, row, firmName(f), text_color = color.white, text_size = size.small, text_halign = text.align_left, bgcolor = color.new(c, 55))
table.cell(tb, 1, row, na(nr) ? "–" : str.format_time(nr, "HH:mm", "UTC") + " UTC", text_color = color.white, text_size = size.small)
table.cell(tb, 2, row, na(nr) ? "–" : leftText(nr - timenow), text_color = color.white, text_size = size.small)
if showTbl and barstate.islast
table.clear(tb, 0, 0, 2, 11)
table.cell(tb, 0, 0, "Firm", text_color = color.gray, text_size = size.small, text_halign = text.align_left)
table.cell(tb, 1, 0, "Next day starts", text_color = color.gray, text_size = size.small)
table.cell(tb, 2, 0, "In", text_color = color.gray, text_size = size.small)
int last = 1
if compare
for [i, f] in firms
addRow(i + 1, f, array.get(colors, i))
last := 10
else
addRow(1, firmIn, lineCol)
last := 2
if not timeframe.isintraday
table.cell(tb, 0, last, "Lines show on intraday charts only", text_color = color.gray, text_size = size.tiny, text_halign = text.align_left)