Goal: Simplify the order ticket generation for webhook message
This library has been created in order to simplify the webhook message generation process. Instead of having to fidget around with string concatenations this method allows you to generate a JSON based message that contains the required information to automte your trades.
How to use? 1) import the library 2) Call the method: GenerateOT () (OT = OrderTicket) 3) Declare your orders: 3.1) Create instances for the buy/sell/close order tickets - store each one in a variable 3.2) Call the variable inside the strategy's function as a alert message: (
DONE! You will now have a dynamic webhook message that will send the correct information to your automation service.
Got Questions, Modifications, Improvements? Comment below or Private message me!
The method you can import:
GenerateOT(license_id, symbol, action, order_type, trade_type, size, price, tp, sl, risk, trailPrice, trailOffset) CreateOrderTicket: Establishes a order ticket following appropriate guidelines. Parameters: license_id (string): Provide your license id symbol (string): Symbol on which to execute the trade action (string): Execution method of the trade : "MRKT" or "PENDING" order_type (string): Direction type of the order: "BUY" or "SELL" trade_type (string): Is it a "SPREAD" trade or a "SINGLE" symbol execution? size (float): Size of the trade, in units price (float): If the order is pending you must specify the execution price tp (float): (Optional) Take profit of the order [price, ticks, percent] sl (float): (Optional) Stop loss of the order [price, ticks, percent] risk (float): Percent to risk for the trade, if size not specified trailPrice (float): (Optional) Price at which trailing stop is starting trailOffset (float): (Optional) Amount to trail by [percent, ticks] Returns: Return Order string
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Un saluto all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.