PINE LIBRARY
已更新 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.
版本注释
Updated版本注释
v3版本注释
updated版本注释
v5Pine脚本库
本着真正的TradingView精神,作者将此Pine代码发布为开源库,以便我们社区的其他Pine程序员可以重复使用它。向作者致敬!您可以私密或在其他开源出版物中使用此库,但在出版物中重复使用此代码受网站规则约束。
Built your TradingView Tools with Pine Script Experts - milvetti.com
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
Pine脚本库
本着真正的TradingView精神,作者将此Pine代码发布为开源库,以便我们社区的其他Pine程序员可以重复使用它。向作者致敬!您可以私密或在其他开源出版物中使用此库,但在出版物中重复使用此代码受网站规则约束。
Built your TradingView Tools with Pine Script Experts - milvetti.com
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。