PINE LIBRARY
SWLib_Signals

Library "SWLib_Signals"
checkPivotCross_Anlik(sysEn, lvlEn, active, inPos, pVal)
Parameters:
sysEn (bool): Pivot system active
lvlEn (bool): This level active
active (bool): This pivot active (reactivated)
inPos (bool): Already entered from this pivot
pVal (float): Pivot price value
Returns: Pivot triggered
checkPivotCross_MumKapanisi(sysEn, lvlEn, active, inPos, pVal, isLong)
Parameters:
sysEn (bool)
lvlEn (bool)
active (bool)
inPos (bool)
pVal (float)
isLong (bool)
checkPivotReactivate(sysEn, pVal, isLong)
Parameters:
sysEn (bool)
pVal (float)
isLong (bool)
checkPivotCross(mode, sysEn, lvlEn, active, inPos, pVal, isLong)
Parameters:
mode (string): 'Anlık' (Instant) or 'Mum Kapanışı' (Bar Close)
sysEn (bool)
lvlEn (bool)
active (bool)
inPos (bool)
pVal (float)
isLong (bool)
Returns: Pivot triggered
f_calcMACD(cfg, flagsL, flagsS)
Parameters:
cfg (MACDConfig): MACD configuration
flagsL (MACDTrigFlags): Long trigger flags
flagsS (MACDTrigFlags): Short trigger flags
Returns: [triggerLong, triggerShort]
allowSignal(enabled, src, lvl, rule)
Parameters:
enabled (bool): Filter active
src (float): Source value
lvl (float): Comparison level
rule (string): 'Altında Engelle' (Block Below) or 'Üstünde Engelle' (Block Above)
Returns: true = signal allowed
allowPriceSignal(enabled, line, rule)
Parameters:
enabled (bool)
line (float)
rule (string)
allowZoneSignal(enabled, zoneSrc)
Parameters:
enabled (bool)
zoneSrc (float): >= 0.5 means zone is active (entry allowed)
Returns: true = signal allowed
allowLineRangeDual(enabled, lineLevel, pctAbove, pctBelow, modeAbove, modeBelow)
Parameters:
enabled (bool): Filter active
lineLevel (float): Line price level
pctAbove (float): Above % threshold
pctBelow (float): Below % threshold
modeAbove (string): 'Eşik İçi' (Inside) or 'Eşik Dışı' (Outside)
modeBelow (string): 'Eşik İçi' (Inside) or 'Eşik Dışı' (Outside)
Returns: true = signal allowed
blockPass(mode, e1, p1, e2, p2, e3, p3, eZ, pZ)
Parameters:
mode (string): 'AND' or 'OR'
e1 (bool): Blocker 1 enabled
p1 (bool): Blocker 1 passed
e2 (bool): Blocker 2 enabled
p2 (bool): Blocker 2 passed
e3 (bool): Blocker 3 enabled
p3 (bool): Blocker 3 passed
eZ (bool): Zone enabled
pZ (bool): Zone passed
Returns: true = signal allowed
checkSignalInstant(use, src)
Parameters:
use (bool): Source active
src (float): Source value (0 = no signal)
Returns: true = signal exists
detectTick(use, currentVal, lastVal, prevBarVal)
Parameters:
use (bool): Source active
currentVal (float): Current source value
lastVal (float): Last recorded value (held with varip)
prevBarVal (float): Previous bar value (src[1])
Returns: true = new signal tick detected
zoneOrCombine(enableArray, passArray)
Parameters:
enableArray (array<bool>): bool array: Active states
passArray (array<bool>): bool array: Pass results
Returns: true = all filters passed (or none active)
ppZoneBlock(blockEnable, blockMode, inZone, checkSide)
Parameters:
blockEnable (bool): Block active
blockMode (string): 'Long', 'Short', 'Her İkisi' (Both)
inZone (bool): Is in zone (src >= 0.5)
checkSide (string): 'Long' or 'Short' - checked direction
Returns: true = signal BLOCKED
anySignalActive(signals)
Parameters:
signals (array<bool>): array<bool>: 7 signal slots + pivot + MACD latch results
Returns: true = at least one signal active
finalTrigger(rawTrigger, blockPassResult, zoneCombined, pivotDistPass, ppZoneBlocked)
Parameters:
rawTrigger (bool): Raw signal (before filters)
blockPassResult (bool): BlockPass result
zoneCombined (bool): Zone OR combination
pivotDistPass (bool): Pivot distance filter
ppZoneBlocked (bool): PP zone blocked
Returns: true = signal valid (all filters passed)
MACDConfig
Fields:
oscType (series string)
fast (series int)
slow (series int)
sig (series int)
sigType (series string)
l1 (series float)
l2 (series float)
l3 (series float)
l4 (series float)
l5 (series float)
MACDTrigFlags
Fields:
crossUP (series bool)
crossDN (series bool)
ml1U (series bool)
ml1D (series bool)
ml2U (series bool)
ml2D (series bool)
ml3U (series bool)
ml3D (series bool)
ml4U (series bool)
ml4D (series bool)
ml5U (series bool)
ml5D (series bool)
sl1U (series bool)
sl1D (series bool)
sl2U (series bool)
sl2D (series bool)
sl3U (series bool)
sl3D (series bool)
sl4U (series bool)
sl4D (series bool)
sl5U (series bool)
sl5D (series bool)
SignalSlot
Fields:
use (series bool)
src (series float)
srcPrice (series float)
BlockerConfig
Fields:
enable (series bool)
src (series float)
level (series float)
rule (series string)
LineBlockerConfig
Fields:
enable (series bool)
src (series float)
pctAbove (series float)
pctBelow (series float)
modeAbove (series string)
modeBelow (series string)
ZoneBlocker
Fields:
enable (series bool)
src (series float)
checkPivotCross_Anlik(sysEn, lvlEn, active, inPos, pVal)
Parameters:
sysEn (bool): Pivot system active
lvlEn (bool): This level active
active (bool): This pivot active (reactivated)
inPos (bool): Already entered from this pivot
pVal (float): Pivot price value
Returns: Pivot triggered
checkPivotCross_MumKapanisi(sysEn, lvlEn, active, inPos, pVal, isLong)
Parameters:
sysEn (bool)
lvlEn (bool)
active (bool)
inPos (bool)
pVal (float)
isLong (bool)
checkPivotReactivate(sysEn, pVal, isLong)
Parameters:
sysEn (bool)
pVal (float)
isLong (bool)
checkPivotCross(mode, sysEn, lvlEn, active, inPos, pVal, isLong)
Parameters:
mode (string): 'Anlık' (Instant) or 'Mum Kapanışı' (Bar Close)
sysEn (bool)
lvlEn (bool)
active (bool)
inPos (bool)
pVal (float)
isLong (bool)
Returns: Pivot triggered
f_calcMACD(cfg, flagsL, flagsS)
Parameters:
cfg (MACDConfig): MACD configuration
flagsL (MACDTrigFlags): Long trigger flags
flagsS (MACDTrigFlags): Short trigger flags
Returns: [triggerLong, triggerShort]
allowSignal(enabled, src, lvl, rule)
Parameters:
enabled (bool): Filter active
src (float): Source value
lvl (float): Comparison level
rule (string): 'Altında Engelle' (Block Below) or 'Üstünde Engelle' (Block Above)
Returns: true = signal allowed
allowPriceSignal(enabled, line, rule)
Parameters:
enabled (bool)
line (float)
rule (string)
allowZoneSignal(enabled, zoneSrc)
Parameters:
enabled (bool)
zoneSrc (float): >= 0.5 means zone is active (entry allowed)
Returns: true = signal allowed
allowLineRangeDual(enabled, lineLevel, pctAbove, pctBelow, modeAbove, modeBelow)
Parameters:
enabled (bool): Filter active
lineLevel (float): Line price level
pctAbove (float): Above % threshold
pctBelow (float): Below % threshold
modeAbove (string): 'Eşik İçi' (Inside) or 'Eşik Dışı' (Outside)
modeBelow (string): 'Eşik İçi' (Inside) or 'Eşik Dışı' (Outside)
Returns: true = signal allowed
blockPass(mode, e1, p1, e2, p2, e3, p3, eZ, pZ)
Parameters:
mode (string): 'AND' or 'OR'
e1 (bool): Blocker 1 enabled
p1 (bool): Blocker 1 passed
e2 (bool): Blocker 2 enabled
p2 (bool): Blocker 2 passed
e3 (bool): Blocker 3 enabled
p3 (bool): Blocker 3 passed
eZ (bool): Zone enabled
pZ (bool): Zone passed
Returns: true = signal allowed
checkSignalInstant(use, src)
Parameters:
use (bool): Source active
src (float): Source value (0 = no signal)
Returns: true = signal exists
detectTick(use, currentVal, lastVal, prevBarVal)
Parameters:
use (bool): Source active
currentVal (float): Current source value
lastVal (float): Last recorded value (held with varip)
prevBarVal (float): Previous bar value (src[1])
Returns: true = new signal tick detected
zoneOrCombine(enableArray, passArray)
Parameters:
enableArray (array<bool>): bool array: Active states
passArray (array<bool>): bool array: Pass results
Returns: true = all filters passed (or none active)
ppZoneBlock(blockEnable, blockMode, inZone, checkSide)
Parameters:
blockEnable (bool): Block active
blockMode (string): 'Long', 'Short', 'Her İkisi' (Both)
inZone (bool): Is in zone (src >= 0.5)
checkSide (string): 'Long' or 'Short' - checked direction
Returns: true = signal BLOCKED
anySignalActive(signals)
Parameters:
signals (array<bool>): array<bool>: 7 signal slots + pivot + MACD latch results
Returns: true = at least one signal active
finalTrigger(rawTrigger, blockPassResult, zoneCombined, pivotDistPass, ppZoneBlocked)
Parameters:
rawTrigger (bool): Raw signal (before filters)
blockPassResult (bool): BlockPass result
zoneCombined (bool): Zone OR combination
pivotDistPass (bool): Pivot distance filter
ppZoneBlocked (bool): PP zone blocked
Returns: true = signal valid (all filters passed)
MACDConfig
Fields:
oscType (series string)
fast (series int)
slow (series int)
sig (series int)
sigType (series string)
l1 (series float)
l2 (series float)
l3 (series float)
l4 (series float)
l5 (series float)
MACDTrigFlags
Fields:
crossUP (series bool)
crossDN (series bool)
ml1U (series bool)
ml1D (series bool)
ml2U (series bool)
ml2D (series bool)
ml3U (series bool)
ml3D (series bool)
ml4U (series bool)
ml4D (series bool)
ml5U (series bool)
ml5D (series bool)
sl1U (series bool)
sl1D (series bool)
sl2U (series bool)
sl2D (series bool)
sl3U (series bool)
sl3D (series bool)
sl4U (series bool)
sl4D (series bool)
sl5U (series bool)
sl5D (series bool)
SignalSlot
Fields:
use (series bool)
src (series float)
srcPrice (series float)
BlockerConfig
Fields:
enable (series bool)
src (series float)
level (series float)
rule (series string)
LineBlockerConfig
Fields:
enable (series bool)
src (series float)
pctAbove (series float)
pctBelow (series float)
modeAbove (series string)
modeBelow (series string)
ZoneBlocker
Fields:
enable (series bool)
src (series float)
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.