PINE LIBRARY
Atualizado Milvetti_TraderPost_Library

Library "Milvetti_TraderPost_Library"
This library has methods that provide practical signal transmission for traderpost.Developed By Milvetti
cancelOrders(symbol)
This method generates a signal in JSON format that cancels all orders for the specified pair. (If you want to cancel stop loss and takeprofit orders together, use the “exitOrder” method.
Parameters:
symbol (string)
exitOrders(symbol)
This method generates a signal in JSON format that close all orders for the specified pair.
Parameters:
symbol (string)
createOrder(ticker, positionType, orderType, entryPrice, signalPrice, qtyType, qty, stopLoss, stopType, stopValue, takeProfit, profitType, profitValue, timeInForce)
This function is designed to send buy or sell orders to traderpost. It can create customized orders by flexibly specifying parameters such as order type, position type, entry price, quantity calculation method, stop-loss, and take-profit. The purpose of the function is to consolidate all necessary details for opening a position into a single structure and present it as a structured JSON output. This format can be sent to trading platforms via webhooks.
Parameters:
ticker (string): The ticker symbol of the instrument. Default value is the current chart's ticker (syminfo.ticker).
positionType (string): Determines the type of order (e.g., "long" or "buy" for buying and "short" or "sell" for selling).
orderType (string): Defines the order type for execution. Options: "market", "limit", "stop". Default is "market"
entryPrice (float): The price level for entry orders. Only applicable for limit or stop orders. Default is 0 (market orders ignore this).
signalPrice (float): Optional. Only necessary when using relative take profit or stop losses, and the broker does not support fetching quotes to perform the calculation. Default is 0
qtyType (string): Determines how the order quantity is calculated. Options: "fixed_quantity", "dollar_amount", "percent_of_equity", "percent_of_position".
qty (float): Quantity value. Can represent units of shares/contracts or a dollar amount, depending on qtyType.
stopLoss (bool): Enable or disable stop-loss functionality. Set to `true` to activate.
stopType (string): Specifies the stop-loss calculation type. Options: percent, "amount", "stopPrice", "trailPercent", "trailAmount". Default is "stopPrice"
stopValue (float): Stop-loss value based on stopType. Can be a percentage, dollar amount, or a specific stop price. Default is "stopPrice"
takeProfit (bool): Enable or disable take-profit functionality. Set to `true` to activate.
profitType (string): Specifies the take-profit calculation type. Options: "percent", "amount", "limitPrice". Default is "limitPrice"
profitValue (float): Take-profit value based on profitType. Can be a percentage, dollar amount, or a specific limit price. Default is 0
timeInForce (string): The time in force for your order. Options: day, gtc, opg, cls, ioc and fok
Returns: Return result in Json format.
addTsl(symbol, stopType, stopValue, price)
This method adds trailing stop loss to the current position. “Price” is the trailing stop loss starting level. You can leave price blank if you want it to start immediately
Parameters:
symbol (string)
stopType (string): Specifies the trailing stoploss calculation type. Options: "trailPercent", "trailAmount".
stopValue (float): Stop-loss value based on stopType. Can be a percentage, dollar amount.
price (float): The trailing stop loss starting level. You can leave price blank if you want it to start immediately. Default is current price.
This library has methods that provide practical signal transmission for traderpost.Developed By Milvetti
cancelOrders(symbol)
This method generates a signal in JSON format that cancels all orders for the specified pair. (If you want to cancel stop loss and takeprofit orders together, use the “exitOrder” method.
Parameters:
symbol (string)
exitOrders(symbol)
This method generates a signal in JSON format that close all orders for the specified pair.
Parameters:
symbol (string)
createOrder(ticker, positionType, orderType, entryPrice, signalPrice, qtyType, qty, stopLoss, stopType, stopValue, takeProfit, profitType, profitValue, timeInForce)
This function is designed to send buy or sell orders to traderpost. It can create customized orders by flexibly specifying parameters such as order type, position type, entry price, quantity calculation method, stop-loss, and take-profit. The purpose of the function is to consolidate all necessary details for opening a position into a single structure and present it as a structured JSON output. This format can be sent to trading platforms via webhooks.
Parameters:
ticker (string): The ticker symbol of the instrument. Default value is the current chart's ticker (syminfo.ticker).
positionType (string): Determines the type of order (e.g., "long" or "buy" for buying and "short" or "sell" for selling).
orderType (string): Defines the order type for execution. Options: "market", "limit", "stop". Default is "market"
entryPrice (float): The price level for entry orders. Only applicable for limit or stop orders. Default is 0 (market orders ignore this).
signalPrice (float): Optional. Only necessary when using relative take profit or stop losses, and the broker does not support fetching quotes to perform the calculation. Default is 0
qtyType (string): Determines how the order quantity is calculated. Options: "fixed_quantity", "dollar_amount", "percent_of_equity", "percent_of_position".
qty (float): Quantity value. Can represent units of shares/contracts or a dollar amount, depending on qtyType.
stopLoss (bool): Enable or disable stop-loss functionality. Set to `true` to activate.
stopType (string): Specifies the stop-loss calculation type. Options: percent, "amount", "stopPrice", "trailPercent", "trailAmount". Default is "stopPrice"
stopValue (float): Stop-loss value based on stopType. Can be a percentage, dollar amount, or a specific stop price. Default is "stopPrice"
takeProfit (bool): Enable or disable take-profit functionality. Set to `true` to activate.
profitType (string): Specifies the take-profit calculation type. Options: "percent", "amount", "limitPrice". Default is "limitPrice"
profitValue (float): Take-profit value based on profitType. Can be a percentage, dollar amount, or a specific limit price. Default is 0
timeInForce (string): The time in force for your order. Options: day, gtc, opg, cls, ioc and fok
Returns: Return result in Json format.
addTsl(symbol, stopType, stopValue, price)
This method adds trailing stop loss to the current position. “Price” is the trailing stop loss starting level. You can leave price blank if you want it to start immediately
Parameters:
symbol (string)
stopType (string): Specifies the trailing stoploss calculation type. Options: "trailPercent", "trailAmount".
stopValue (float): Stop-loss value based on stopType. Can be a percentage, dollar amount.
price (float): The trailing stop loss starting level. You can leave price blank if you want it to start immediately. Default is current price.
Notas de Lançamento
UpdatedNotas de Lançamento
v3Notas de Lançamento
updatedNotas de Lançamento
v5Biblioteca do Pine
No verdadeiro espirito do TradingView, o autor desse código Pine o publicou como uma biblioteca de código aberto, para que outros programadores Pine da nossa comunidade possam reusa-los. Parabéns ao autor! Você pode usar essa biblioteca privadamente ou em outras publicações de código aberto, mas a reutilização desse código em publicações é regida pelas Regras da Casa.
Built Your TradingView Tools With Experts
milvetti.com
milvetti.com
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Biblioteca do Pine
No verdadeiro espirito do TradingView, o autor desse código Pine o publicou como uma biblioteca de código aberto, para que outros programadores Pine da nossa comunidade possam reusa-los. Parabéns ao autor! Você pode usar essa biblioteca privadamente ou em outras publicações de código aberto, mas a reutilização desse código em publicações é regida pelas Regras da Casa.
Built Your TradingView Tools With Experts
milvetti.com
milvetti.com
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.