PINE LIBRARY
已更新 libKageBot

Library "libKageBot"
Library of function to generate command strings for bots FrostyBot and Zignally. This version ONLY WORKS WITH FROSTYBOT.
strSize(_sizePercent, _sizeCurrency)
Converts a float to a formated string suitable to position size in percentage or currency. At leaste one parameter must be given
Parameters:
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
Returns: (string) A formated string containing the position size
entry(_bot, _direction, _sizePercent, _sizeCurrency)
Generates a simple entry command string for a bot
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_direction: (string) Flag to opena long or a short position. Must be either DIRECTION_LONG or DIRECTION_SHORT constant
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
Returns: (string) A string of a simple open position command
exit(_bot, _sizePercent, _sizeCurrency, _reduce)
Generates a simple exit command string for a bot
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
_reduce: (bool) Flag to use Ruce Only option on Binance positions. Optional. Default = true
Returns: (string) A string of a simple close position command
cancelAll(_bot)
Generates a command string for a bot that cancels all open orders
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
Returns: (string) A string of a command to cancel all open orders
leverage(_bot, _leverage, _type)
Generates a command string for a bot to set leverage
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_leverage: (int) The amount of leverage to be used when opening a position. Optional. If does not given, the bot's default will be used
_type: (string) Type of leverage. Must be either LEVERAGE_CROSS or LEVERAGE_ISOLATED. Optional. Default is LEVERAGE_CROSS.
Returns: (string) A string of a simple leverage command
entryLong(_bot, _leverage, _leverageType, _sizePercent, _sizeCurrency)
Generates a complete long entry command string for a bot
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_leverage: (int) The amount of leverage to be used when opening a position. Optional. If does not given, the bot's default will be used
_leverageType: (string) Type of leverage. Must be either LEVERAGE_CROSS or LEVERAGE_ISOLATED. Optional. Default is LEVERAGE_CROSS.
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
Returns: (string) A string of a complete open long position command
entryShort(_bot, _leverage, _leverageType, _sizePercent, _sizeCurrency)
Generates a complete short entry command string for a bot
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_leverage: (int) The amount of leverage to be used when opening a position. Optional. If does not given, the bot's default will be used
_leverageType
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
Returns: (string) A string of a complete open short position command
exitPosition(_bot, _sizePercent, _sizeCurrency, _reduce)
Generates a complete close position command string for a bot
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
_reduce: (bool) Flag to use Ruce Only option on Binance positions. Optional. Default = true
Returns: (string) A string of a comlete close position command
printBot(_bot, _command)
Print bot's information for debug purposes
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_command: (string) A command string to be debugged
Returns: Nothing.
Constants
Constants to be used in both in internal and external code
Fields:
SERVER_FROSTBOT: (string) Identifier to FrostyBot
SERVER_ZIGNALY: (string) Identifier to Zignaly
DIRECTION_LONG: (string) Flag to open a long position
DIRECTION_SHORT
LEVERAGE_CROSS: (string) Flag to set leverage to cross
LEVERAGE_ISOLATED: (string) Flag to set leverage to isolated
TradeBot
Bot type to handle its essential information
Fields:
server: (string) Type o server. Must me one of the SERVER_* constant values
id: (string) Id of the account in the server (Stub for FrostyBot or Key to Zignally)
symbol: (string) Symbol of the pair to be negotiated (example: ETH/USDT)
leverage: (int) Leverage coeficient. Default is 1
Library of function to generate command strings for bots FrostyBot and Zignally. This version ONLY WORKS WITH FROSTYBOT.
strSize(_sizePercent, _sizeCurrency)
Converts a float to a formated string suitable to position size in percentage or currency. At leaste one parameter must be given
Parameters:
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
Returns: (string) A formated string containing the position size
entry(_bot, _direction, _sizePercent, _sizeCurrency)
Generates a simple entry command string for a bot
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_direction: (string) Flag to opena long or a short position. Must be either DIRECTION_LONG or DIRECTION_SHORT constant
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
Returns: (string) A string of a simple open position command
exit(_bot, _sizePercent, _sizeCurrency, _reduce)
Generates a simple exit command string for a bot
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
_reduce: (bool) Flag to use Ruce Only option on Binance positions. Optional. Default = true
Returns: (string) A string of a simple close position command
cancelAll(_bot)
Generates a command string for a bot that cancels all open orders
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
Returns: (string) A string of a command to cancel all open orders
leverage(_bot, _leverage, _type)
Generates a command string for a bot to set leverage
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_leverage: (int) The amount of leverage to be used when opening a position. Optional. If does not given, the bot's default will be used
_type: (string) Type of leverage. Must be either LEVERAGE_CROSS or LEVERAGE_ISOLATED. Optional. Default is LEVERAGE_CROSS.
Returns: (string) A string of a simple leverage command
entryLong(_bot, _leverage, _leverageType, _sizePercent, _sizeCurrency)
Generates a complete long entry command string for a bot
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_leverage: (int) The amount of leverage to be used when opening a position. Optional. If does not given, the bot's default will be used
_leverageType: (string) Type of leverage. Must be either LEVERAGE_CROSS or LEVERAGE_ISOLATED. Optional. Default is LEVERAGE_CROSS.
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
Returns: (string) A string of a complete open long position command
entryShort(_bot, _leverage, _leverageType, _sizePercent, _sizeCurrency)
Generates a complete short entry command string for a bot
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_leverage: (int) The amount of leverage to be used when opening a position. Optional. If does not given, the bot's default will be used
_leverageType
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
Returns: (string) A string of a complete open short position command
exitPosition(_bot, _sizePercent, _sizeCurrency, _reduce)
Generates a complete close position command string for a bot
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_sizePercent: (float) Position size in percent value. Optional. Default = na. Mandatory if _sizeCurrency is not given.
_sizeCurrency: (float) Position size in currency value. Optional. Default = na. Mandatory if _sizePercent is not given.
_reduce: (bool) Flag to use Ruce Only option on Binance positions. Optional. Default = true
Returns: (string) A string of a comlete close position command
printBot(_bot, _command)
Print bot's information for debug purposes
Parameters:
_bot: (TradeBot) Previously instancied bot type variable
_command: (string) A command string to be debugged
Returns: Nothing.
Constants
Constants to be used in both in internal and external code
Fields:
SERVER_FROSTBOT: (string) Identifier to FrostyBot
SERVER_ZIGNALY: (string) Identifier to Zignaly
DIRECTION_LONG: (string) Flag to open a long position
DIRECTION_SHORT
LEVERAGE_CROSS: (string) Flag to set leverage to cross
LEVERAGE_ISOLATED: (string) Flag to set leverage to isolated
TradeBot
Bot type to handle its essential information
Fields:
server: (string) Type o server. Must me one of the SERVER_* constant values
id: (string) Id of the account in the server (Stub for FrostyBot or Key to Zignally)
symbol: (string) Symbol of the pair to be negotiated (example: ETH/USDT)
leverage: (int) Leverage coeficient. Default is 1
發行說明
v2Updated:
Constants
Constants to be used in both in internal and external code
Fields:
SERVER_FROSTBOT: (string) Identifier to FrostyBot
SERVER_ZIGNALY: (string) Identifier to Zignaly
DIRECTION_LONG: (string) Flag to open a long position
DIRECTION_SHORT: (string) Flag to open a short position
LEVERAGE_CROSS: (string) Flag to set leverage to cross
LEVERAGE_ISOLATED: (string) Flag to set leverage to isolated
TradeBot
Bot type to handle bot's essential information
Fields:
server: (string) Type o server. Must me one of the SERVER_* constant values
id: (string) Id of the account in the server (Stub for FrostyBot or Key to Zignally)
symbol: (string) Symbol of the pair to be negotiated (example: ETH/USDT)
leverage: (int) Leverage coeficient. Default is 1
Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。