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

Perpustakaan Pine

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai satu perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman.


Pinetrader.io
pinetrader.io
Juga pada:

Penafian