Momentum Stream Checklist

Mohamoud7muhidin · study · 237 行 · 点赞 919 · TradingView 原页

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

Pine Script

//@version=6
indicator("Custom Manual Trading Checklist v2", overlay = true)
 
// ============================================
// 1. GENERAL SETTINGS
// ============================================
g1 = "01 - General Settings"
 
dashboardTitle = input.string("MY TRADING CHECKLIST", "Dashboard Title", group = g1)
 
tradeDirection = input.string("BUY", "Trade Direction",
     options = ["BUY", "SELL"], group = g1)
 
targetType = input.string("Liquidity (Impulsive)", "Target",
     options = ["Liquidity (Impulsive)", "OB (Pullback)"],
     group = g1)
 
// ============================================
// 2. CUSTOM CHECKLIST
// Each rule has:
// - Enable: show/hide
// - Name: custom text
// - Done: manual checkbox
// ============================================
 
g2 = "02 - Market Setup"
 
e1 = input.bool(true, "Show", inline = "r1", group = g2)
n1 = input.string("1H Momentum + 1H/45M OB Return", "Rule 1", group = g2)
c1 = input.bool(false, "Completed", inline = "r1", group = g2)
 
e2 = input.bool(true, "Show", inline = "r2", group = g2)
n2 = input.string("15M Momentum Break", "Rule 2", group = g2)
c2 = input.bool(false, "Completed", inline = "r2", group = g2)
 
e3 = input.bool(true, "Show", inline = "r3", group = g2)
n3 = input.string("5M Momentum Break", "Rule 3", group = g2)
c3 = input.bool(false, "Completed", inline = "r3", group = g2)
 
g3 = "03 - Entry Confirmation"
 
e4 = input.bool(true, "Show", inline = "r4", group = g3)
n4 = input.string("3M/1M Common Sense", "Rule 4", group = g3)
c4 = input.bool(false, "Completed", inline = "r4", group = g3)
 
g4 = "04 - Targets and Zone"
 
e5 = input.bool(true, "Show", inline = "r5", group = g4)
n5 = input.string("Target Confirmed", "Rule 5", group = g4)
c5 = input.bool(false, "Completed", inline = "r5", group = g4)
 
e6 = input.bool(true, "Show", inline = "r6", group = g4)
n6 = input.string("Zone Break OR 15M/5M Reversal", "Rule 6", group = g4)
c6 = input.bool(false, "Completed", inline = "r6", group = g4)
 
g5 = "05 - Trading Discipline"
 
e7 = input.bool(true, "Show", inline = "r7", group = g5)
n7 = input.string("Risk Management", "Rule 7", group = g5)
c7 = input.bool(false, "Completed", inline = "r7", group = g5)
 
e8 = input.bool(true, "Show", inline = "r8", group = g5)
n8 = input.string("Daily Goal", "Rule 8", group = g5)
c8 = input.bool(false, "Completed", inline = "r8", group = g5)
 
e9 = input.bool(true, "Show", inline = "r9", group = g5)
n9 = input.string("Timing", "Rule 9", group = g5)
c9 = input.bool(false, "Completed", inline = "r9", group = g5)
 
// ============================================
// 3. DASHBOARD CUSTOMIZATION
// ============================================
g6 = "06 - Dashboard Appearance"
 
dashboardPosition = input.string("Top Right", "Position",
     options = [
     "Top Left", "Top Center", "Top Right",
     "Middle Left", "Middle Center", "Middle Right",
     "Bottom Left", "Bottom Center", "Bottom Right"],
     group = g6)
 
fontSize = input.string("Small", "Text Size",
     options = ["Tiny", "Small", "Normal", "Large"],
     group = g6)
 
showNumbers = input.bool(true, "Show Rule Numbers", group = g6)
showProgress = input.bool(true, "Show Progress", group = g6)
showTarget = input.bool(true, "Show Target Type", group = g6)
 
g7 = "07 - Custom Colors"
 
headerColor = input.color(color.rgb(15, 23, 42), "Header Background", group = g7)
backgroundColor = input.color(color.rgb(30, 41, 59), "Row Background", group = g7)
textColor = input.color(color.white, "Text Color", group = g7)
completedColor = input.color(color.rgb(34, 197, 94), "Completed Color", group = g7)
pendingColor = input.color(color.rgb(156, 163, 175), "Pending Color", group = g7)
accentColor = input.color(color.rgb(250, 204, 21), "Accent Color", group = g7)
 
// ============================================
// 4. DISPLAY CONFIGURATION
// ============================================
panelPosition = switch dashboardPosition
    "Top Left" => position.top_left
    "Top Center" => position.top_center
    "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
    "Bottom Right" => position.bottom_right
    => position.top_right
 
txtSize = switch fontSize
    "Tiny" => size.tiny
    "Normal" => size.normal
    "Large" => size.large
    => size.small
 
// ============================================
// 5. CHECKLIST DATA
// ============================================
names = array.from(n1, n2, n3, n4, n5, n6, n7, n8, n9)
 
enabled = array.from(e1, e2, e3, e4, e5, e6, e7, e8, e9)
 
checked = array.from(c1, c2, c3, c4, c5, c6, c7, c8, c9)
 
int total = 0
int completed = 0
 
for i = 0 to 8
    if array.get(enabled, i)
        total += 1
        if array.get(checked, i)
            completed += 1
 
bool allDone = total > 0 and completed == total
 
float progress = total > 0 ? completed * 100.0 / total : 0.0
 
// ============================================
// 6. CREATE DASHBOARD
// ============================================
var table panel = table.new(
     panelPosition, 2, 14,
     bgcolor = backgroundColor,
     border_width = 1,
     border_color = color.rgb(71, 85, 105))
 
// ============================================
// 7. RENDER DASHBOARD
// ============================================
if barstate.islast
 
    table.clear(panel, 0, 0, 1, 13)
 
    // HEADER
    table.cell(panel, 0, 0, dashboardTitle,
         bgcolor = headerColor,
         text_color = textColor,
         text_size = txtSize,
         text_halign = text.align_left)
 
    table.cell(panel, 1, 0, tradeDirection,
         bgcolor = headerColor,
         text_color = tradeDirection == "BUY" ? completedColor : color.rgb(239, 68, 68),
         text_size = txtSize)
 
    int row = 1
 
    // OPTIONAL TARGET
    if showTarget
        table.cell(panel, 0, row, "TARGET",
             bgcolor = headerColor,
             text_color = textColor,
             text_size = txtSize)
 
        table.cell(panel, 1, row, targetType,
             bgcolor = headerColor,
             text_color = accentColor,
             text_size = txtSize)
        row += 1
 
    // CHECKLIST ROWS
    for i = 0 to 8
        bool visible = array.get(enabled, i)
 
        if visible
            string ruleName = array.get(names, i)
            bool isDone = array.get(checked, i)
 
            string displayName = showNumbers ? str.tostring(i + 1) + ". " + ruleName : ruleName
 
            string status = isDone ? "✓ DONE" : "○ WAIT"
 
            table.cell(panel, 0, row, displayName,
                 bgcolor = backgroundColor,
                 text_color = textColor,
                 text_size = txtSize,
                 text_halign = text.align_left)
 
            table.cell(panel, 1, row, status,
                 bgcolor = backgroundColor,
                 text_color = isDone ? completedColor : pendingColor,
                 text_size = txtSize)
 
            row += 1
 
    // PROGRESS
    if showProgress
        table.cell(panel, 0, row, "PROGRESS",
             bgcolor = headerColor,
             text_color = textColor,
             text_size = txtSize)
 
        table.cell(panel, 1, row,
             str.tostring(completed) + "/" + str.tostring(total) +
             " (" + str.tostring(progress, "#.0") + "%)",
             bgcolor = headerColor,
             text_color = allDone ? completedColor : accentColor,
             text_size = txtSize)
 
        row += 1
 
    // FINAL STATUS
    string finalStatus = total == 0 ? "NO RULES ENABLED" :
         allDone ? "ALL CHECKED" : "WAIT FOR CONFIRMATION"
 
    table.cell(panel, 0, row, finalStatus,
         bgcolor = headerColor,
         text_color = allDone ? completedColor : accentColor,
         text_size = txtSize)
 
    table.cell(panel, 1, row, allDone ? "READY" : "WAIT",
         bgcolor = headerColor,
         text_color = allDone ? completedColor : pendingColor,
         text_size = txtSize)

← 返回列表