PINE LIBRARY
Trade Wzrd - Library Alert String Utils

Trade Wzrd - Library Alert String Utils
WHAT IT IS
Open-source Pine library that builds comma-separated webhook alert strings for automated order commands. Import name: TradeWzrdAlerts.
This is an educational protocol helper for strategy and indicator authors. It is not a signal service and does not place broker orders by itself.
WHY IT EXISTS (ORIGINALITY)
Most automation scripts hand-concatenate alert text. That causes dialect drift, missing parameters, and broken multi-command messages. This library is a single export surface for the full command set used with webhook-style automation:
Market: BUY, SELL
Pending: BUYLIMIT, SELLLIMIT, BUYSTOP, SELLSTOP
Futures-style: BRACKET, REMOVE_SL, REMOVE_TP
Manage: MODIFY, BREAKEVEN
Close: CLOSE, CLOSEALL, LAYER_CLOSE
Cancel: CANCEL
It also provides zero-config PRICE helpers so you can pass exact strategy stop and take-profit prices (no manual pip math), plus a multi() joiner for semicolon-separated command chains.
HOW IT WORKS
1) Each command function returns one string: COMMAND,SYMBOL[,KEY=VALUE...]
2) Optional parameters are omitted when unset (na or empty string). Legitimate zero values such as OFFSET=0 are still emitted when you pass them.
3) COMMENT text is sanitized so commas and semicolons cannot break multi-command grammar.
4) Invalid required fields (empty symbol, pending without PRICE, MODIFY with neither SL nor TP) return an empty string. Callers should not fire alerts on empty strings.
5) Zero-config helpers (buyPrice, sellPrice, bracketPrice, modifySlPrice, breakEvenPrice, closePercent) force TPSLTYPE=PRICE and format prices with mintick precision.
HOW TO USE
1) Publish or open this library, then import it in your script (replace username and version as shown on the library page):
import USERNAME/TradeWzrdAlerts/1 as TW
2) Build a message, for example:
msg = TW.buy("EURUSD", vol=0.01, sl=100, tp=200, tpslType="PIPS")
3) Pass msg into strategy.entry / strategy.exit alert_message, or call alert(msg) when length(msg) > 0
4) Create a TradingView alert with message:
{{strategy.order.alert_message}}
or use Any alert() function call when using alert()
5) Point the alert webhook field at whatever endpoint you already use
DEFAULTS AND RULES
- Symbol is pass-through (not force-uppercased)
- Ticket is an optional string parameter
- TPSLTYPE is only written when you provide it (except zero-config PRICE helpers)
- multi(a,b,...) joins non-empty segments with semicolons
LIMITATIONS
- Library only builds text. Execution quality depends on your webhook receiver and broker
- Pending-order automation support depends on your backend and platform
- Past results and example strings do not predict live performance
- Not intended as financial advice
No external links are required to understand or use this library.
WHAT IT IS
Open-source Pine library that builds comma-separated webhook alert strings for automated order commands. Import name: TradeWzrdAlerts.
This is an educational protocol helper for strategy and indicator authors. It is not a signal service and does not place broker orders by itself.
WHY IT EXISTS (ORIGINALITY)
Most automation scripts hand-concatenate alert text. That causes dialect drift, missing parameters, and broken multi-command messages. This library is a single export surface for the full command set used with webhook-style automation:
Market: BUY, SELL
Pending: BUYLIMIT, SELLLIMIT, BUYSTOP, SELLSTOP
Futures-style: BRACKET, REMOVE_SL, REMOVE_TP
Manage: MODIFY, BREAKEVEN
Close: CLOSE, CLOSEALL, LAYER_CLOSE
Cancel: CANCEL
It also provides zero-config PRICE helpers so you can pass exact strategy stop and take-profit prices (no manual pip math), plus a multi() joiner for semicolon-separated command chains.
HOW IT WORKS
1) Each command function returns one string: COMMAND,SYMBOL[,KEY=VALUE...]
2) Optional parameters are omitted when unset (na or empty string). Legitimate zero values such as OFFSET=0 are still emitted when you pass them.
3) COMMENT text is sanitized so commas and semicolons cannot break multi-command grammar.
4) Invalid required fields (empty symbol, pending without PRICE, MODIFY with neither SL nor TP) return an empty string. Callers should not fire alerts on empty strings.
5) Zero-config helpers (buyPrice, sellPrice, bracketPrice, modifySlPrice, breakEvenPrice, closePercent) force TPSLTYPE=PRICE and format prices with mintick precision.
HOW TO USE
1) Publish or open this library, then import it in your script (replace username and version as shown on the library page):
import USERNAME/TradeWzrdAlerts/1 as TW
2) Build a message, for example:
msg = TW.buy("EURUSD", vol=0.01, sl=100, tp=200, tpslType="PIPS")
3) Pass msg into strategy.entry / strategy.exit alert_message, or call alert(msg) when length(msg) > 0
4) Create a TradingView alert with message:
{{strategy.order.alert_message}}
or use Any alert() function call when using alert()
5) Point the alert webhook field at whatever endpoint you already use
DEFAULTS AND RULES
- Symbol is pass-through (not force-uppercased)
- Ticket is an optional string parameter
- TPSLTYPE is only written when you provide it (except zero-config PRICE helpers)
- multi(a,b,...) joins non-empty segments with semicolons
LIMITATIONS
- Library only builds text. Execution quality depends on your webhook receiver and broker
- Pending-order automation support depends on your backend and platform
- Past results and example strings do not predict live performance
- Not intended as financial advice
No external links are required to understand or use this library.
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.