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)
Pine腳本庫
秉持TradingView一貫精神,作者已將此Pine代碼以開源函式庫形式發佈,方便我們社群中的其他Pine程式設計師重複使用。向作者致敬!您可以在私人專案或其他開源發表中使用此函式庫,但在公開發表中重用此代碼須遵守社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
Pine腳本庫
秉持TradingView一貫精神,作者已將此Pine代碼以開源函式庫形式發佈,方便我們社群中的其他Pine程式設計師重複使用。向作者致敬!您可以在私人專案或其他開源發表中使用此函式庫,但在公開發表中重用此代碼須遵守社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。