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

Biblioteca Pine

Siguiendo fielmente el espíritu TradingView, el autor ha publicado este código Pine como una biblioteca de código abierto, permitiendo que otros programadores de Pine en nuestra comunidad lo utilicen de nuevo. ¡Olé por el autor! Puede utilizar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero tenga en cuenta que la reutilización de este código en una publicación se rige por las Normas internas.


Pinetrader.io
pinetrader.io
También en:

Exención de responsabilidad