PINE LIBRARY

PineTraderLibrary

PineTrader Library Documentation

Overview
The PineTrader Library provides functionality to generate standardized order tickets for trading operations. The library's main function GenerateOT creates JSON-formatted order tickets that can be sent via webhook.

Main Function: GenerateOT
Purpose
Creates a formatted JSON order ticket string following Pinetrader.io specifications, handling both simple and complex order scenarios.
Parameters
Required Parameters
  • []license_id (string): Your license identifier
    []symbol (string): Trading symbol/instrument
    []action (string): Order execution method
    Valid values: "MRKT" (market) or "PENDING"
    []order_type (string): Direction of the trade
    Valid values: "BUY" or "SELL"
  • trade_type (string): Trade execution category
    Valid values: "SPREAD" or "SINGLE"


Optional Parameters
  • []size (float, default=0.0): Trade size in units
    []price (float, default=0.0): Execution price (required for pending orders)
    []tp (float, default=0.0): Take profit level [price, ticks, or percent]
    []sl (float, default=0.0): Stop loss level [price, ticks, or percent]
    []risk (float, default=0.0): Risk percentage (used when size is not specified)
    []trailPrice (float, default=0.0): Starting price for trailing stop
  • trailOffset (float, default=0.0): Trailing amount [percent or ticks]


Return Value
Returns a JSON-formatted string containing the order ticket information. The function automatically handles:
  • []Proper JSON formatting with curly braces
    []Removal of trailing commas
    []Inclusion of only non-zero values
    []Numeric formatting for float values


Output Format


Implementation Notes
  • []The function uses dynamic string construction for flexibility
    []Optional parameters are only included in the output if their value is non-zero
    []JSON formatting follows standard conventions for webhook compatibility
    []The library operates under Mozilla Public License 2.0
  • The function handles proper numeric formatting for all float values
alertsAPIformattingpinescriptpinetraderstringswebhook

ספריית Pine

ברוח TradingView אמיתית, המחבר פרסם קוד Pine זה כספריית קוד פתוח כדי שמתכנתי Pine אחרים מהקהילה שלנו יוכלו לעשות בו שימוש חוזר. כל הכבוד למחבר! אתה יכול להשתמש בספרייה זו באופן פרטי או בפרסומים אחרים בקוד פתוח, אך שימוש חוזר בקוד זה בפרסום כפוף לכללי הבית.


Pinetrader.io
pinetrader.io
גם על:

כתב ויתור