PINE LIBRARY
Telah dikemas kini

TradersPostDeluxe

323
Library "TradersPostDeluxe"
TradersPost integration. It's currently not very deluxe

SendEntryAlert(ticker, action, quantity, orderType, takeProfit, stopLoss, id, price, timestamp, timezone)
  Sends an alert to TradersPost to trigger an Entry
  Parameters:
    ticker (string): Symbol to trade. Default is syminfo.ticker
    action (series Action): TradersPostAction (.buy, .sell) default = buy
    quantity (float): Amount to trade, default = 1
    orderType (series OrderType): TradersPostOrderType, default =e TradersPostOrderType.market
    takeProfit (float): Take profit limit price
    stopLoss (float): Stop loss price
    id (string): id for the trade
    price (float): Expected price
    timestamp (int): Time of the trade for reporting, defaults to timenow
    timezone (string): associated with the time, defaults to syminfo.timezone
  Returns: Nothing

SendExitAlert(ticker, price, timestamp, timezone)
  Sends an alert to TradersPost to trigger an Exit
  Parameters:
    ticker (string): Symbol to flatten
    price (float): Documented planned price
    timestamp (int): Time of the trade for reporting, defaults to timenow
    timezone (string): associated with the time, defaults to syminfo.timezone
  Returns: Nothing
Nota Keluaran
A million things
Nota Keluaran
v3
Nota Keluaran
v4

Updated: supports signalPrice
Nota Keluaran
v5
Nota Keluaran
Better alignment with TradersPost parameters
Removed unrealistic order tracking
Nota Keluaran
v7
Match TradersPost fields whenever possible
Replace all TradersPost magic strings with enums for type safety
Nota Keluaran
**v8.0 (2025-09-14)**

- **Enhanced SendBracketOrder logic**: Fixed entryPrice routing to properly support all order types (market, limit, stop, stop_limit, trailing_stop)
- **New _buildBracketOrderParams helper function**: Automatically routes entryPrice to the correct parameter based on orderType, preventing order type/price parameter mismatches
- **signalPrice parameter added to all helper functions**: SendSentiment, SendBracketOrder, SendOTOOrder, SendOCOOrder, and SendOrderNoCancelExisting now all support signalPrice for better slippage tracking
- **Comprehensive bracket order testing**: Added unit tests to ensure proper JSON generation for each order type
- **Improved documentation**: Enhanced guide with clear explanations of entryPrice/orderType relationships

### Breaking Changes

- **SendBracketOrder behavior change**: The entryPrice parameter now correctly routes to limitPrice or stopPrice based on orderType instead of always going to limitPrice
- **Helper function signatures updated**: All helper functions now include signalPrice parameter (optional, defaults to na)

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.