PINE LIBRARY
Lib_SW_Visual

Library "Lib_SW_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)
drawMPLabel(isLong, barIdx, priceY, totalProfit)
Parameters:
isLong (bool): Direction
barIdx (int): Bar index for label
priceY (float): Y-axis price (high for Long, low for Short)
totalProfit (float): Accumulated trade PnL
Returns: Created label
persistLabel(lbl, latch, cleanup, barIdx, price, txt, isUp, col, txtCol, sz, yloc_mode)
Parameters:
lbl (label): Current label reference (var label)
latch (bool): Is the trigger active
cleanup (bool): Delete label when latch goes off (Webhook=true, swpspace=false)
barIdx (int): Bar index
price (float): Y axis price
txt (string): Label text
isUp (bool): Label style up (true) or down (false)
col (color): Background color
txtCol (color): Text color
sz (string): Size string ('small', 'normal', 'tiny')
yloc_mode (string): Yloc mode: 'price', 'abovebar', 'belowbar', 'default'
Returns: Updated label reference
persistFELabel(lbl, latch, cleanup, blocked, showBlockedLbl, barIdx, price, txt, isUp, col)
Parameters:
lbl (label): Current label reference
latch (bool): Is trigger active
cleanup (bool): Delete on latch off
blocked (bool): Is the exit blocked
showBlockedLbl (bool): Show full label when blocked
barIdx (int): Bar index
price (float): Y price
txt (string): Label text
isUp (bool): true=style_label_up, false=style_label_down
col (color): Background color
Returns: Updated label reference
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
drawHLine(ln, price, col, w, sty)
Parameters:
ln (line): Current line reference (will be deleted if not na)
price (float): Price level
col (color): Line color
w (int): Line width (default 1)
sty (string): Style string: 'solid', 'dashed', 'dotted'
Returns: New line
deleteLines9(l1, l2, l3, l4, l5, l6, l7, l8, l9)
Parameters:
l1 (line): Line 1 to delete
l2 (line): Line 2 to delete
l3 (line): Line 3 to delete
l4 (line): Line 4 to delete
l5 (line): Line 5 to delete
l6 (line): Line 6 to delete
l7 (line): Line 7 to delete
l8 (line): Line 8 to delete
l9 (line): Line 9 to delete
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)
drawMPLabel(isLong, barIdx, priceY, totalProfit)
Parameters:
isLong (bool): Direction
barIdx (int): Bar index for label
priceY (float): Y-axis price (high for Long, low for Short)
totalProfit (float): Accumulated trade PnL
Returns: Created label
persistLabel(lbl, latch, cleanup, barIdx, price, txt, isUp, col, txtCol, sz, yloc_mode)
Parameters:
lbl (label): Current label reference (var label)
latch (bool): Is the trigger active
cleanup (bool): Delete label when latch goes off (Webhook=true, swpspace=false)
barIdx (int): Bar index
price (float): Y axis price
txt (string): Label text
isUp (bool): Label style up (true) or down (false)
col (color): Background color
txtCol (color): Text color
sz (string): Size string ('small', 'normal', 'tiny')
yloc_mode (string): Yloc mode: 'price', 'abovebar', 'belowbar', 'default'
Returns: Updated label reference
persistFELabel(lbl, latch, cleanup, blocked, showBlockedLbl, barIdx, price, txt, isUp, col)
Parameters:
lbl (label): Current label reference
latch (bool): Is trigger active
cleanup (bool): Delete on latch off
blocked (bool): Is the exit blocked
showBlockedLbl (bool): Show full label when blocked
barIdx (int): Bar index
price (float): Y price
txt (string): Label text
isUp (bool): true=style_label_up, false=style_label_down
col (color): Background color
Returns: Updated label reference
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
drawHLine(ln, price, col, w, sty)
Parameters:
ln (line): Current line reference (will be deleted if not na)
price (float): Price level
col (color): Line color
w (int): Line width (default 1)
sty (string): Style string: 'solid', 'dashed', 'dotted'
Returns: New line
deleteLines9(l1, l2, l3, l4, l5, l6, l7, l8, l9)
Parameters:
l1 (line): Line 1 to delete
l2 (line): Line 2 to delete
l3 (line): Line 3 to delete
l4 (line): Line 4 to delete
l5 (line): Line 5 to delete
l6 (line): Line 6 to delete
l7 (line): Line 7 to delete
l8 (line): Line 8 to delete
l9 (line): Line 9 to delete
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)
Biblioteka Pine
W zgodzie z duchem TradingView autor opublikował ten kod Pine jako bibliotekę open-source, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Ukłony dla autora. Można korzystać z tej biblioteki prywatnie lub w innych publikacjach open-source, jednak ponowne wykorzystanie tego kodu w publikacjach podlega Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Biblioteka Pine
W zgodzie z duchem TradingView autor opublikował ten kod Pine jako bibliotekę open-source, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Ukłony dla autora. Można korzystać z tej biblioteki prywatnie lub w innych publikacjach open-source, jednak ponowne wykorzystanie tego kodu w publikacjach podlega Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.