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
Updated: supports signalPrice
Removed unrealistic order tracking
Match TradersPost fields whenever possible
Replace all TradersPost magic strings with enums for type safety
- **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)
Perpustakaan Pine
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda juga boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini dalam penerbitan adalah tertakluk kepada Peraturan Dalaman.
Penafian
Perpustakaan Pine
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda juga boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini dalam penerbitan adalah tertakluk kepada Peraturan Dalaman.