OPEN-SOURCE SCRIPT

Dashboard Ais

//version=5
indicator("Custom Trading Dashboard", overlay=true)

/////////// DASHBOARD SETTINGS ///////////
bgColor = color.rgb(20, 30, 40, 90) // Background color of the dashboard
textColor = color.white // Text color
highlightColor = color.rgb(80, 150, 50, 90) // Highlight color

/////////// DATA SOURCES ///////////
symbol = syminfo.ticker
entryPrice = input.float(0.0, "Entry Price")
stopLoss = input.float(0.0, "Stop Loss Price")
takeProfit = input.float(0.0, "Take Profit Price")
riskRatio = na(entryPrice - stopLoss) or na(takeProfit - entryPrice) ? na : ((takeProfit - entryPrice) / (entryPrice - stopLoss))

/////////// HISTORY CALCULATIONS ///////////
tpToday = close > takeProfit ? 1 : 0
slToday = close < stopLoss ? 1 : 0

tpWeekly = close > takeProfit ? 1 : 0
slWeekly = close < stopLoss ? 1 : 0

/////////// DRAW DASHBOARD ///////////
// Declare table variable with 2 columns and 6 rows
var table dashboard = table.new(position.top_right, 2, 6, bgcolor=bgColor, border_width=1)

// Add content to the table
if bar_index == 0
// Header row
table.cell(dashboard, 0, 0, "Custom Dashboard", text_color=color.orange, text_size=size.large, bgcolor=highlightColor)
table.cell(dashboard, 0, 1, "", bgcolor=highlightColor)

// Symbol
table.cell(dashboard, 1, 0, "Symbol:", text_color=textColor)
table.cell(dashboard, 1, 1, symbol, text_color=textColor)

// Entry Price
table.cell(dashboard, 2, 0, "Entry Price:", text_color=textColor)
table.cell(dashboard, 2, 1, str.tostring(entryPrice), text_color=textColor)

// Risk Ratio
table.cell(dashboard, 3, 0, "Risk Ratio:", text_color=textColor)
table.cell(dashboard, 3, 1, na(riskRatio) ? "N/A" : str.tostring(riskRatio, "#.##"), text_color=textColor)

// History Header
table.cell(dashboard, 4, 0, "History (TP/SL)", text_color=textColor, bgcolor=highlightColor)
table.cell(dashboard, 4, 1, "", bgcolor=highlightColor)

// Today TP/SL
table.cell(dashboard, 5, 0, "Today:", text_color=textColor)
table.cell(dashboard, 5, 1, str.tostring(tpToday) + " / " + str.tostring(slToday), text_color=textColor)

// Weekly TP/SL
table.cell(dashboard, 6, 0, "Weekly:", text_color=textColor)
table.cell(dashboard, 6, 1, str.tostring(tpWeekly) + " / " + str.tostring(slWeekly), text_color=textColor)

Bands and Channelseducationalstatistics

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明