PINE LIBRARY
SWLib_Visual

Library "SWLib_Visual"
drawEntryLabel(isLong, barIdx, priceY, txt, bgCol, txtCol, sz)
Parameters:
isLong (bool): Is Long
barIdx (int): Bar index
priceY (float): Y axis price
txt (string): Label text
bgCol (color): Background color
txtCol (color): Text color
sz (string): Size string ('tiny', 'small', 'normal')
Returns: Created label
drawTPLabel(isLong, barIdx, price, tpNum, pnlStr, isDCA, col)
Parameters:
isLong (bool): Is Long
barIdx (int): Bar index
price (float): TP price
tpNum (int): TP number (1, 2, 3)
pnlStr (string): PnL formatted string
isDCA (bool): Is DCA TP
col (color): TP color
Returns: Created label
drawSLLabel(isLong, barIdx, price, pnlStr, isTrailing, col)
Parameters:
isLong (bool)
barIdx (int)
price (float)
pnlStr (string)
isTrailing (bool)
col (color)
drawForceExitLabel(isLong, barIdx, price, pnlStr, col)
Parameters:
isLong (bool)
barIdx (int)
price (float)
pnlStr (string)
col (color)
drawSwingLabel(fromLong, barIdx, price, pnlStr, col)
Parameters:
fromLong (bool)
barIdx (int)
price (float)
pnlStr (string)
col (color)
drawLiqLabel(isLong, barIdx, liqPrice, col)
Parameters:
isLong (bool)
barIdx (int)
liqPrice (float)
col (color)
updateHLine(ln, barIdx, price, col, style, width)
Parameters:
ln (line): Current line (if na, creates new)
barIdx (int): Start bar index
price (float): Price level
col (color): Line color
style (string): Line style
width (int): Line width
Returns: Updated/Created line
deleteLine(ln)
Parameters:
ln (line): Line to delete
deleteAllLines(grp)
Parameters:
grp (LineGroup): Line group
updateTPLines(grp, barIdx, tp1, tp2, tp3, colTP)
Parameters:
grp (LineGroup): Current line group
barIdx (int): Start bar index
tp1 (float): TP1 price
tp2 (float): TP2 price (na if not drawn)
tp3 (float): TP3 price (na if not drawn)
colTP (color): TP color
Returns: Updated line group
updateSLLine(grp, barIdx, slPrice, colSL)
Parameters:
grp (LineGroup)
barIdx (int)
slPrice (float)
colSL (color)
updateAvgLine(grp, barIdx, avgPrice, colAvg)
Parameters:
grp (LineGroup)
barIdx (int)
avgPrice (float)
colAvg (color)
panelCell(tbl, row, txt, txtCol, bgCol, tipTxt)
Parameters:
tbl (table): Table reference
row (int): Row number
txt (string): Content
txtCol (color): Text color
bgCol (color): Background color (optional)
tipTxt (string): Tooltip (optional)
panelCellSimple(tbl, row, txt, txtCol, bgCol)
Parameters:
tbl (table)
row (int)
txt (string)
txtCol (color)
bgCol (color)
pnlColor(pnl, posColor, negColor)
Parameters:
pnl (float): PnL value
posColor (color): Positive color
negColor (color): Negative color
Returns: Appropriate color
sessionStatus(dateError, activeSession, sessionStarted)
Parameters:
dateError (bool): Is there a date error
activeSession (bool): Is session active
sessionStarted (bool): Has session started
Returns: [statusText, statusColor]
drawPivotLines(pp, r1, r2, r3, s1, s2, s3, showPivots, colPP, colR, colS)
Parameters:
pp (float): Pivot Point
r1 (float): Resistance 1
r2 (float): Resistance 2
r3 (float): Resistance 3
s1 (float): Support 1
s2 (float): Support 2
s3 (float): Support 3
showPivots (bool): Show/Hide
colPP (color): Pivot color
colR (color): Resistance color
colS (color): Support color
Returns: void (lines updated)
tpColor(tpNum, col1, col2, col3)
Parameters:
tpNum (int): TP number (1, 2, 3)
col1 (color): TP1 color
col2 (color): TP2 color
col3 (color): TP3 color
Returns: Selected color
fade(col, transp)
Parameters:
col (color): Color
transp (int): Transparency (0-100)
Returns: Faded color
stackY(stackCount, baseOffset)
Parameters:
stackCount (int): Current stack count
baseOffset (float): Base offset value (h-l or mintick*50)
Returns: Y axis offset
safeOffset()
VisualMarker
Fields:
txt (series string)
bgColor (series color)
txtColor (series color)
sz (series string)
LineGroup
Fields:
entryLine (series line)
avgLine (series line)
tp1Line (series line)
tp2Line (series line)
tp3Line (series line)
slLine (series line)
liqLine (series line)
tsLine (series line)
PanelTheme
Fields:
bgColor (series color)
borderColor (series color)
textPrimary (series color)
textGreen (series color)
textRed (series color)
textYellow (series color)
textBlue (series color)
textOrange (series color)
textCyan (series color)
drawEntryLabel(isLong, barIdx, priceY, txt, bgCol, txtCol, sz)
Parameters:
isLong (bool): Is Long
barIdx (int): Bar index
priceY (float): Y axis price
txt (string): Label text
bgCol (color): Background color
txtCol (color): Text color
sz (string): Size string ('tiny', 'small', 'normal')
Returns: Created label
drawTPLabel(isLong, barIdx, price, tpNum, pnlStr, isDCA, col)
Parameters:
isLong (bool): Is Long
barIdx (int): Bar index
price (float): TP price
tpNum (int): TP number (1, 2, 3)
pnlStr (string): PnL formatted string
isDCA (bool): Is DCA TP
col (color): TP color
Returns: Created label
drawSLLabel(isLong, barIdx, price, pnlStr, isTrailing, col)
Parameters:
isLong (bool)
barIdx (int)
price (float)
pnlStr (string)
isTrailing (bool)
col (color)
drawForceExitLabel(isLong, barIdx, price, pnlStr, col)
Parameters:
isLong (bool)
barIdx (int)
price (float)
pnlStr (string)
col (color)
drawSwingLabel(fromLong, barIdx, price, pnlStr, col)
Parameters:
fromLong (bool)
barIdx (int)
price (float)
pnlStr (string)
col (color)
drawLiqLabel(isLong, barIdx, liqPrice, col)
Parameters:
isLong (bool)
barIdx (int)
liqPrice (float)
col (color)
updateHLine(ln, barIdx, price, col, style, width)
Parameters:
ln (line): Current line (if na, creates new)
barIdx (int): Start bar index
price (float): Price level
col (color): Line color
style (string): Line style
width (int): Line width
Returns: Updated/Created line
deleteLine(ln)
Parameters:
ln (line): Line to delete
deleteAllLines(grp)
Parameters:
grp (LineGroup): Line group
updateTPLines(grp, barIdx, tp1, tp2, tp3, colTP)
Parameters:
grp (LineGroup): Current line group
barIdx (int): Start bar index
tp1 (float): TP1 price
tp2 (float): TP2 price (na if not drawn)
tp3 (float): TP3 price (na if not drawn)
colTP (color): TP color
Returns: Updated line group
updateSLLine(grp, barIdx, slPrice, colSL)
Parameters:
grp (LineGroup)
barIdx (int)
slPrice (float)
colSL (color)
updateAvgLine(grp, barIdx, avgPrice, colAvg)
Parameters:
grp (LineGroup)
barIdx (int)
avgPrice (float)
colAvg (color)
panelCell(tbl, row, txt, txtCol, bgCol, tipTxt)
Parameters:
tbl (table): Table reference
row (int): Row number
txt (string): Content
txtCol (color): Text color
bgCol (color): Background color (optional)
tipTxt (string): Tooltip (optional)
panelCellSimple(tbl, row, txt, txtCol, bgCol)
Parameters:
tbl (table)
row (int)
txt (string)
txtCol (color)
bgCol (color)
pnlColor(pnl, posColor, negColor)
Parameters:
pnl (float): PnL value
posColor (color): Positive color
negColor (color): Negative color
Returns: Appropriate color
sessionStatus(dateError, activeSession, sessionStarted)
Parameters:
dateError (bool): Is there a date error
activeSession (bool): Is session active
sessionStarted (bool): Has session started
Returns: [statusText, statusColor]
drawPivotLines(pp, r1, r2, r3, s1, s2, s3, showPivots, colPP, colR, colS)
Parameters:
pp (float): Pivot Point
r1 (float): Resistance 1
r2 (float): Resistance 2
r3 (float): Resistance 3
s1 (float): Support 1
s2 (float): Support 2
s3 (float): Support 3
showPivots (bool): Show/Hide
colPP (color): Pivot color
colR (color): Resistance color
colS (color): Support color
Returns: void (lines updated)
tpColor(tpNum, col1, col2, col3)
Parameters:
tpNum (int): TP number (1, 2, 3)
col1 (color): TP1 color
col2 (color): TP2 color
col3 (color): TP3 color
Returns: Selected color
fade(col, transp)
Parameters:
col (color): Color
transp (int): Transparency (0-100)
Returns: Faded color
stackY(stackCount, baseOffset)
Parameters:
stackCount (int): Current stack count
baseOffset (float): Base offset value (h-l or mintick*50)
Returns: Y axis offset
safeOffset()
VisualMarker
Fields:
txt (series string)
bgColor (series color)
txtColor (series color)
sz (series string)
LineGroup
Fields:
entryLine (series line)
avgLine (series line)
tp1Line (series line)
tp2Line (series line)
tp3Line (series line)
slLine (series line)
liqLine (series line)
tsLine (series line)
PanelTheme
Fields:
bgColor (series color)
borderColor (series color)
textPrimary (series color)
textGreen (series color)
textRed (series color)
textYellow (series color)
textBlue (series color)
textOrange (series color)
textCyan (series color)
Thư viện Pine
Theo đúng tinh thần TradingView, tác giả đã công bố mã Pine này như một thư viện mã nguồn mở để các lập trình viên Pine khác trong cộng đồng có thể tái sử dụng. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này cho mục đích cá nhân hoặc trong các ấn phẩm mã nguồn mở khác, nhưng việc tái sử dụng mã này trong các ấn phẩm phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Thư viện Pine
Theo đúng tinh thần TradingView, tác giả đã công bố mã Pine này như một thư viện mã nguồn mở để các lập trình viên Pine khác trong cộng đồng có thể tái sử dụng. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này cho mục đích cá nhân hoặc trong các ấn phẩm mã nguồn mở khác, nhưng việc tái sử dụng mã này trong các ấn phẩm phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.