RCV Daily Checklist & Trader Profiles

RCVisionaries · study · 376 行 · 点赞 11 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=6
// RCV Daily Checklist 4.10
// A pre-trade panel of static reminders: the day and the session open now (New York time), an Alkemi Macro review line
// and the trader's rules, nothing to tick.
// Below it or beside it, the six RCV trader profiles (STF / MTF / HTF) with this chart's timeframe in bold blue.
indicator("RCV Daily Checklist", "RCV Checklist", overlay = true, behind_chart = false)
 
// ── Fixed parameters ─────────────────────────────────────────────────────────────────────────────────────────────────
const string NY         = "America/New_York"
const int    MAX_ROWS   = 40
const float  GAP        = 0.4
 
enum Psize
    mobile = "Mobile"
    small  = "Small"
    normal = "Normal"
    large  = "Large"
 
enum Ppos
    tl = "Top Left"
    tc = "Top Center"
    tr = "Top Right"
    ml = "Middle Left"
    mr = "Middle Right"
    bl = "Bottom Left"
    bc = "Bottom Center"
    br = "Bottom Right"
 
enum Layout
    stacked = "Stacked"
    side    = "Side by Side"  // pinelint: allow PL03 (enum member, chosen in the inputs)
 
enum Profile
    none  = "Not set"
    micro = "Micro"
    scalp = "Scalp"
    minor = "Minor Intraday"
    major = "Major Intraday"
    swing = "Swing"
    pos   = "Position"
 
enum Show
    highlight = "Highlight My Profile"
    only      = "Only My Profile"
 
enum Theme
    light  = "Light"
    dark   = "Dark"
    custom = "Custom"
 
const string G_CHK = "Checklist"
const string G_PRF = "Trader Profiles"
const string G_PNL = "Panel"
 
const string TIP_SES = "The session open now, New York time. Closed Friday 17:00 to Sunday 17:00 (crypto never closes)."
const string ALK_TX  = "Review Alkemi Macro"
const string ALK_TIP = "Check today's calendar, risk mood and news: https://alkemi-macro.com"
const string R1_TX = "Direction, Liquidity, Execution"
const string R2_TX = "Be Dynamic: What's Against Me?"
const string R3_TX = "Continuation > Reversal"
const string R4_TX = "Reactions ≠ Follow-throughs"
const string TIP_PN  = "Show the panel, its text size and position."
const string TIP_LY  = "Stacked: profiles under the checklist. Side by Side: profiles to the right."
const string TIP_PRF = "Shade your profile, or show only yours."
const string TIP_PRS = "Untick to hide a profile."
const string TIP_TTL = "Columns: STF (entry chart), MTF (one step up, read the story), HTF (bigger picture, furthest target)."
const string TIP_LN  = "Grid color and width, then frame width. 0 hides a line."
const string TIP_NT  = "One rule per line, up to 10. Leave empty to hide Notes."
const string TIP_TH  = "Light for white charts, Dark for dark charts, Custom for your own colors."
 
// ── Inputs ───────────────────────────────────────────────────────────────────────────────────────────────────────────
bool   ckOn    = input.bool(true, "Show Checklist", group = G_CHK)
bool   dayOn   = input.bool(true, "Day", inline = "show", group = G_CHK) // pinelint: allow PL06
bool   sesOn   = input.bool(true, "Session", inline = "show", group = G_CHK, tooltip = TIP_SES) // pinelint: allow PL06
bool   alkOn   = input.bool(true, "Alkemi Macro", inline = "show", group = G_CHK, tooltip = ALK_TIP)
string notesTx = input.text_area(R1_TX + "\n" + R2_TX + "\n" + R3_TX + "\n" + R4_TX, "Notes", group = G_CHK, tooltip = TIP_NT)
 
 
bool    prfOn = input.bool(true, "Show Trader Profiles", group = G_PRF)
Profile prfIn = input.enum(Profile.none, "My Profile", inline = "pr", group = G_PRF)
Show    show  = input.enum(Show.highlight, "", inline = "pr", group = G_PRF, tooltip = TIP_PRF)
bool    p0On  = input.bool(true, "Micro", inline = "ps_a", group = G_PRF)
bool    p1On  = input.bool(true, "Scalp", inline = "ps_a", group = G_PRF)
bool    p2On  = input.bool(true, "Minor Intraday", inline = "ps_a", group = G_PRF, tooltip = TIP_PRS)
bool    p3On  = input.bool(true, "Major Intraday", inline = "ps_b", group = G_PRF)
bool    p4On  = input.bool(true, "Swing", inline = "ps_b", group = G_PRF)
bool    p5On  = input.bool(true, "Position", inline = "ps_b", group = G_PRF)
 
bool   panelOn  = input.bool(true, "Show Panel", inline = "pn_a", group = G_PNL)
Psize  panelSz  = input.enum(Psize.small, "", inline = "pn_a", group = G_PNL)
Ppos   panelPos = input.enum(Ppos.mr, "", inline = "pn_a", group = G_PNL, tooltip = TIP_PN)
Layout layoutIn = input.enum(Layout.stacked, "Layout", group = G_PNL, tooltip = TIP_LY)
Theme  theme    = input.enum(Theme.light, "Theme", group = G_PNL, tooltip = TIP_TH)
color cusUp    = input.color(#01579B, "Highlight / Muted", inline = "pn_c", group = G_PNL, tooltip = "Highlight marks this chart's timeframe and your profile.")
color cusNeu   = input.color(#5F6B73, "", inline = "pn_c", group = G_PNL)
color cusBg    = input.color(color.new(#FFFFFF, 5), "Background / Text", inline = "pn_d", group = G_PNL)
color cusTx    = input.color(#0F171B, "", inline = "pn_d", group = G_PNL)
color cusGrid  = input.color(color.new(#2E2E2E, 50), "Grid", inline = "pn_e", group = G_PNL)
int   gridW    = input.int(1, "", minval = 0, maxval = 5, inline = "pn_e", group = G_PNL)
int   frameW   = input.int(1, "Frame", minval = 0, maxval = 5, inline = "pn_e", group = G_PNL, tooltip = TIP_LN)
 
// ── Helpers ──────────────────────────────────────────────────────────────────────────────────────────────────────────
// "0830" or "8:30" to minutes after midnight; na when the text is not a valid time
hhmm(string s) =>
    string c = str.replace_all(str.trim(s), ":", "")
    float  v = str.tonumber(c)
    int out = na
    if str.length(c) >= 3 and str.length(c) <= 4 and not na(v) and v >= 0
        int h = int(math.floor(v / 100))
        int m = int(v) % 100
        if h < 24 and m < 60
            out := h * 60 + m
    out
 
inSession(string ses, int mod) =>
    int a = hhmm(str.substring(ses, 0, 4))
    int b = hhmm(str.substring(ses, 5, 9))
    bool inside = false
    if not na(a) and not na(b)
        inside := a <= b ? mod >= a and mod < b : mod >= a or mod < b
    inside
 
clock(int m) =>
    str.format("{0,number,00}:{1,number,00}", math.floor(m / 60), m % 60)
 
dateKey(int t, string tz) =>
    year(t, tz) * 10000 + month(t, tz) * 100 + dayofmonth(t, tz)
 
dateText(int k) =>
    str.format("{0,number,0000}-{1,number,00}-{2,number,00}", math.floor(k / 10000), math.floor(k / 100) % 100, k % 100)
 
dayName(int d) =>
    switch d
        dayofweek.monday    => "Monday"
        dayofweek.tuesday   => "Tuesday"
        dayofweek.wednesday => "Wednesday"
        dayofweek.thursday  => "Thursday"
        dayofweek.friday    => "Friday"
        dayofweek.saturday  => "Saturday"
        => "Sunday"
 
// ── Clock (New York) ─────────────────────────────────────────────────────────────────────────────────────────────────
int tNow     = barstate.islast ? timenow : time
int nowH     = hour(tNow, NY)
int nowMod   = nowH * 60 + minute(tNow, NY)
int nowDow   = dayofweek(tNow, NY)
int todayKey = dateKey(tNow, NY)
 
// ── Market ────────────────────────────────────────────────────────────────────────────────────────────────────
 
// FX closes Friday 17:00 and reopens Sunday 17:00 New York; crypto never closes
bool fxShut  = nowDow == dayofweek.saturday or (nowDow == dayofweek.friday and nowMod >= 1020) or (nowDow == dayofweek.sunday and nowMod < 1020)
bool mktShut = syminfo.type != "crypto" and fxShut
// Fixed, back to back: one session is always open while the market is
var array<string> sSes  = array.from("2000-0000", "0000-0200", "0200-0500", "0500-0800", "0800-1200", "1200-1700", "1700-1800", "1800-2000")
var array<string> sName = array.from("Tokyo", "Pre-London", "London Open", "London", "LDN/NY Overlap", "NY", "New Day Open", "Sydney")
string sesNow = "Closed"
string sesList = ""
for [i, t] in sSes
    sesList += "\n" + sName.get(i) + "  " + str.substring(t, 0, 2) + ":" + str.substring(t, 2, 4) + "-" + str.substring(t, 5, 7) + ":" + str.substring(t, 7, 9)
    if not mktShut and inSession(t, nowMod)
        sesNow := sName.get(i)
 
// ── Reminders ────────────────────────────────────────────────────────────────────────────────────────────────────────
// One note per non-empty line, capped so the panel fits its rows
lines(string src, int cap) =>
    array<string> out = array.new<string>()
    for ln in str.split(src, "\n")
        string tx = str.trim(ln)
        if str.length(tx) > 0 and out.size() < cap
            out.push(tx)
    out
 
var array<string> mTx = lines(notesTx, 10)
 
 
// ── Profiles (Cohort IV, 2026-10-16) ─────────────────────────────────────────────────────────────────────────────────
var array<string> pName  = array.from("Micro", "Scalp", "Minor Intraday", "Major Intraday", "Swing", "Position")
var array<string> pStf   = array.from("M1", "M5", "M15", "H1", "H4", "D")
var array<string> pMtf   = array.from("M15", "H1", "H4", "D", "W", "1M")
var array<string> pHtf   = array.from("H1", "H4", "D", "W", "1M", "3M")
var array<string> pStory = array.from("Story lasts a session to a day. Redo it every session.",
     "Story lasts a session to a day. Redo it every session.", "Story lasts a few days. Redo it every daily close.",
     "Story lasts a few days. Redo it every daily close.", "Story lasts weeks. Redo it every weekly close.",
     "Story lasts months. Redo it every monthly close.")
 
int    mult  = timeframe.multiplier
string tfKey = timeframe.isminutes ? (mult == 1 ? "M1" : mult == 5 ? "M5" : mult == 15 ? "M15" : mult == 60 ? "H1" : mult == 240 ? "H4" : "")
     : timeframe.isdaily and mult == 1 ? "D" : timeframe.isweekly and mult == 1 ? "W"
     : timeframe.ismonthly and (mult == 1 or mult == 3) ? str.tostring(mult) + "M" : ""
int asStf = pStf.indexof(tfKey)
int asMtf = pMtf.indexof(tfKey)
int asHtf = pHtf.indexof(tfKey)
 
int picked = switch prfIn
    Profile.micro => 0
    Profile.scalp => 1
    Profile.minor => 2
    Profile.major => 3
    Profile.swing => 4
    Profile.pos   => 5
    => -1
 
// ── Panel (RCV Direction look) ───────────────────────────────────────────────────────────────────────────────────────
color upC = switch theme
    Theme.light => #01579B
    Theme.dark  => #42A5F5
    Theme.custom => cusUp
color neuC = switch theme
    Theme.light => #5F6B73
    Theme.dark  => #8B949E
    Theme.custom => cusNeu
color pnlBase = switch theme
    Theme.light => color.new(#FFFFFF, 5)
    Theme.dark  => color.new(#131722, 5)
    Theme.custom => cusBg
// The table is transparent (for the Side by Side gap), so each cell carries the panel color alone. Squaring the transparency
// gives the same see-through as the color laid twice (table + cell), which is how the other RCV panels draw it
color pnlBg = color.new(pnlBase, color.t(pnlBase) * color.t(pnlBase) / 100)
color pnlTx = switch theme
    Theme.light => #0F171B
    Theme.dark  => #D1D4DC
    Theme.custom => cusTx
color gridC = switch theme
    Theme.light => color.new(#2E2E2E, 50)
    Theme.dark  => color.new(#434651, 30)
    Theme.custom => cusGrid
 
pnlPosition = switch panelPos
    Ppos.tl => position.top_left
    Ppos.tc => position.top_center
    Ppos.tr => position.top_right
    Ppos.ml => position.middle_left
    Ppos.bc => position.bottom_center
    Ppos.bl => position.bottom_left
    Ppos.br => position.bottom_right
    => position.middle_right
 
// Text sizes in points: data rows step by 2, the title and headers stay about 1.2x the data
int headSz = switch panelSz
    Psize.mobile => 10
    Psize.small  => 12
    Psize.normal => 14
    Psize.large  => 17
int dataSz = switch panelSz
    Psize.mobile => 8
    Psize.small  => 10
    Psize.normal => 12
    Psize.large  => 14
 
// Mixed into the panel color, not see-through: the table itself is transparent, so a see-through shade would show the chart
color hiBg = color.from_gradient(15, 0, 100, pnlBg, upC)
 
// A section name, or a note with its leading mark (an icon or a bullet)
type Row
    bool   section
    string name
    string mark
    string tip
 
addNote(array<Row> rows, string note, string tip, string mark = "•") =>
    if str.length(note) > 0
        rows.push(Row.new(false, note, mark, tip))
 
addSection(array<Row> rows, bool show, string name) =>
    if show
        rows.push(Row.new(true, name, "", ""))
 
// ── Panel layout ─────────────────────────────────────────────────────────────────────────────────────────────────────
// One table holds both blocks. Each block writes to its own columns (checklist: mark | text | detail; profiles: name | STF |
// MTF | HTF); aFrom/aTo and bFrom/bTo map those to table columns. Stacked shares five columns (checklist text and detail
// span two each, the profile name spans two); Side by Side gives each block its own columns with a narrow gap column
// between. TradingView draws the grid around every cell slot, so the gap and the space under the shorter block are each
// merged into one cell.
// The profiles block shows when it is on and has at least one profile to list
var array<bool> pOn = array.from(p0On, p1On, p2On, p3On, p4On, p5On)
bool one   = picked >= 0 and show == Show.only
bool prfShow = prfOn and (one or pOn.includes(true))
bool both  = ckOn and prfShow
bool stack = layoutIn == Layout.stacked
int  bOff  = both and not stack ? 4 : 0
var array<int> aFrom = array.new<int>(3)
var array<int> aTo   = array.new<int>(3)
var array<int> bFrom = array.new<int>(4)
var array<int> bTo   = array.new<int>(4)
if barstate.isfirst
    for k = 0 to 2
        aFrom.set(k, stack ? (k == 0 ? 0 : k == 1 ? 1 : 3) : k)
        aTo.set(k, stack ? (k == 0 ? 0 : k == 1 ? 2 : 4) : k)
    for k = 0 to 3
        bFrom.set(k, stack ? (k == 0 ? 0 : k + 1) : k + bOff)
        bTo.set(k, stack ? k + 1 : k + bOff)
int nCols = stack ? 5 : both ? 8 : ckOn ? 3 : 4
 
var table tbl = na
 
put(int c1, int c2, int r, string t, color tc, color bg, int sz, bool mono, string halign, string tip) =>
    tbl.cell(c1, r, t, text_color = tc, bgcolor = bg, text_size = sz, text_halign = halign,
         text_font_family = mono ? font.family_monospace : font.family_default, tooltip = tip)
    if c2 > c1
        tbl.merge_cells(c1, r, c2, r)
 
// Block cells by their own column numbers, from column a to column b
cellA(int a, int b, int r, string t, color tc, int sz, bool mono, string halign, string tip) =>
    put(aFrom.get(a), aTo.get(b), r, t, tc, pnlBg, sz, mono, halign, tip)
 
cellB(int a, int b, int r, string t, color tc, color bg, int sz, bool mono, string halign, string tip) =>
    put(bFrom.get(a), bTo.get(b), r, t, tc, bg, sz, mono, halign, tip)
 
// Checklist block from row r0; returns the number of rows written
drawChecklist(int r0) =>
    array<Row> rows = array.new<Row>()
    addSection(rows, sesOn or dayOn or alkOn, "Market")
    addNote(rows, dayOn ? dayName(nowDow) : "", dateText(todayKey) + ", New York", "📅")
    addNote(rows, sesOn ? sesNow : "", clock(nowMod) + " New York" + sesList, "🕒")
    addNote(rows, alkOn ? ALK_TX : "", ALK_TIP, "📰")
    addSection(rows, mTx.size() > 0, "Notes")
    for tx in mTx
        addNote(rows, tx, "")
 
    cellA(0, 2, r0, "RCV Daily Checklist", pnlTx, headSz, true, text.align_center, "Hover a line for more.")
    int r = r0 + 1
    for rw in rows
        if rw.section
            cellA(0, 2, r, rw.name, neuC, dataSz, true, text.align_left, "")
        else
            cellA(0, 0, r, rw.mark, neuC, dataSz, false, text.align_center, "")
            cellA(1, 2, r, rw.name, pnlTx, dataSz, false, text.align_left, rw.tip)
        r += 1
    r - r0
 
// One profile's row: name (story in the tooltip), then one timeframe per column; this chart's timeframe in bold blue
tfCell(int k, int r, string tf, bool hit, color bg, string tip) =>
    cellB(k, k, r, tf, hit ? upC : pnlTx, bg, dataSz, false, text.align_center, tip)
    if hit
        tbl.cell_set_text_formatting(bFrom.get(k), r, text.format_bold)
 
profileRow(int i, int r, color bg) =>
    cellB(0, 0, r, pName.get(i), pnlTx, bg, dataSz, false, text.align_left, pStory.get(i))
    tfCell(1, r, pStf.get(i), i == asStf, bg, "STF: enter here")
    tfCell(2, r, pMtf.get(i), i == asMtf, bg, "MTF: read the story here, the usual target")
    tfCell(3, r, pHtf.get(i), i == asHtf, bg, "HTF: the bigger picture, the furthest target")
 
// Profiles block from row r0: its own title as a separate block, or a grey "Profiles" section row under the checklist; then
// the six profiles (or only yours); returns the number of rows written
drawProfiles(int r0, bool titled) =>
    if titled
        cellB(0, 3, r0, "RCV Trader Profiles", pnlTx, pnlBg, headSz, true, text.align_center, "RCV Trader Profiles\n" + TIP_TTL)
    else
        cellB(0, 3, r0, "Profiles", neuC, pnlBg, dataSz, true, text.align_left, TIP_TTL)
    int r = r0 + 1
    for i = 0 to 5
        if one ? i == picked : pOn.get(i)
            profileRow(i, r, i == picked and not one ? hiBg : pnlBg)
            r += 1
    r - r0
 
// Rebuilt on every update of the latest bar, so merges always match the rows on show. The table itself is transparent:
// only the cells carry the panel color, so the Side by Side gap shows the chart. Stacked, the profiles are one more section
// under the checklist title
if panelOn and barstate.islast and (ckOn or prfShow)
    tbl.delete()
    tbl := table.new(pnlPosition, nCols, MAX_ROWS, frame_color = pnlTx, frame_width = frameW, border_color = gridC, border_width = gridW)
    int nA = ckOn ? drawChecklist(0) : 0
    int nB = prfShow ? drawProfiles(both and stack ? nA : 0, not (both and stack)) : 0
    if both and not stack
        int nR = math.max(nA, nB)
        tbl.cell(3, 0, "", width = GAP)
        tbl.merge_cells(3, 0, 3, nR - 1)
        // The shorter block ends in one blank panel cell
        if nB < nA
            tbl.cell(4, nB, "", bgcolor = pnlBg)
            tbl.merge_cells(4, nB, 7, nA - 1)
        if nA < nB
            tbl.cell(0, nA, "", bgcolor = pnlBg)
            tbl.merge_cells(0, nA, 2, nB - 1)

← 返回列表