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
Мои профили:

Отказ от ответственности