PINE LIBRARY
已更新

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
發行說明
A million things
發行說明
v3
發行說明
v4

Updated: supports signalPrice
發行說明
v5
發行說明
Better alignment with TradersPost parameters
Removed unrealistic order tracking
發行說明
v7
Match TradersPost fields whenever possible
Replace all TradersPost magic strings with enums for type safety
發行說明
**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)

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。