Mizar_LibraryThe "Mizar_Library" is a powerful tool designed for Pine Script™ programmer’s, providing a collection of general functions that facilitate the usage of Mizar’s DCA (Dollar-Cost-Averaging) bot system.
To begin using the Mizar Library, you first need to import it into your indicator script. Insert the following line below your indicator initiation line: import Mizar_Trading/Mizar_Library/1 as mizar (mizar is the chosen alias).
In the import statement, Mizar_Trading.Mizar_Library_v1 refers to the specific version of the Mizar Library you wish to use. Feel free to modify mizar to your preferred alias name.
Once the library is imported, you can leverage its functions by prefixing them with mizar. . This will prompt auto-completion suggestions displaying all the available user-defined functions provided by the Mizar Library.
Now, let's delve into some of the key functions available in the Mizar Library:
DCA_bot_msg(_cmd)
The DCA_bot_msg function accepts an user-defined type (UDT) _cmd as a parameter and returns a string with the complete JSON command for a Mizar DCA bot.
Parameters:
_cmd (bot_params) : ::: User-defined type (UDT) that holds all the necessary information for the bot command.
Returns: A string with the complete JSON command for a Mizar DCA bot.
rounding_to_ticks(value, ticks, rounding_type)
The rounding_to_ticks function rounds a calculated price to the nearest actual price based on the specified tick size.
Parameters:
value (float) : ::: The calculated price as float type, to be rounded to the nearest real price.
ticks (float) : ::: The smallest possible price obtained through a request in your script.
rounding_type (int) : ::: The rounding type for the price: 0 = closest real price, 1 = closest real price above, 2 = closest real price below.
Returns: A float value representing the rounded price to the next tick.
bot_params
Bot_params is an user-defined type (UDT) that represents the parameters required for a Mizar DCA bot.
Fields:
bot_id (series string) : The ID number of your Mizar DCA bot.
api_key (series string) : Your private API key from your Mizar account (keep it confidential!).
action (series string) : The command to perform: "open" (standard) or "close" optional .
tp_perc (series string) : The take profit percentage in decimal form (1% = "0.01") optional .
base_asset (series string) : The cryptocurrency you want to buy (e.g., "BTC").
quote_asset (series string) : The coin or fiat currency used for payment (e.g., "USDT" is standard if not specified) optional .
direction (series string) : The direction of the position: "long" or "short" (only applicable for two-way hedge bots) optional .
To obtain the JSON command string for the alert_function call, you can use the DCA_bot_msg function provided by the library. Simply pass the cmd_msg UDT as an argument and assign the returned string value to a variable.
Here's an example to illustrate the process:
// Import of the Mizar Library to use the included functions
import/Mizar_Trading/Mizar_Library/1 as mizar
// Example to set a variable called “cmd_msg” and all of its parameters
cmd_msg = mizar.bot_params. new()
cmd_msg.action := "open"
cmd_msg.api_key := "top secret"
cmd_msg.bot_id := "9999"
cmd_msg.base_asset := "BTC"
cmd_msg.quote_asset := "USDT"
cmd_msg.direction := "long"
cmd_msg.tp_perc := "0.015"
// Calling the Mizar conversion function named “DCA_bot_msg()” with the cmd_msg as argument to receive the JSON command and save it in a string variable called “alert_msg”
alert_msg = mizar.DCA_bot_msg(cmd_msg)
Feel free to utilize (series) string variables instead of constant strings. By incorporating the Mizar Library into your Pine Script, you gain access to a powerful set of functions and can leverage them according to your specific requirements.
For additional help or support, you can join the Mizar Discord channel. There, you'll find a dedicated Pine Script channel where you can ask any questions related to Pine Script.
Bot
POALibrary "POA"
This library is a client script for making a webhook signal formatted string to POABOT server.
entry_message(password, percent, leverage, kis_number)
Create a entry message for POABOT
Parameters:
password : (string) The password of your bot.
percent : (float) The percent for entry based on your wallet balance.
leverage : (int) The leverage of entry. If not set, your levereage doesn't change.
kis_number : (int) The number of koreainvestment account.
Returns: (string) A json formatted string for webhook message.
close_message(password, percent, kis_number)
Create a close message for POABOT
Parameters:
password : (string) The password of your bot.
percent : (float) The percent for close based on your wallet balance.
kis_number : (int) The number of koreainvestment account.
Returns: (string) A json formatted string for webhook message.
exit_message(password, percent)
Create a exit message for POABOT
Parameters:
password : (string) The password of your bot.
percent : (float) The percent for exit based on your wallet balance.
Returns: (string) A json formatted string for webhook message.
in_trade(start_time, end_time)
Create a trade start line
Parameters:
start_time : (int) The start of time.
end_time : (int) The end of time.
Returns: (bool) Get bool for trade based on time range.
FrostyBotLibrary "FrostyBot"
JSON Alert Builder for FrostyBot.js Binance Futures and FTX orders
github.com
More Complete Version Soon.
TODO: Comment Functions and annotations from command reference ^^
TODO: Add additional whitelist and symbol mappings.
leverage()
buy()
sell()
cancelall()
closelong()
closeshort()
traillong()
trailshort()
long()
short()
takeprofit()
stoploss()
TradingHookLibrary "TradingHook"
This library is a client script for making a webhook signal formatted string to TradingHook webhook server.
buy_message(password, amount, order_name) Make a buy Message for TradingHook.
Parameters:
password : (string) password that you set in .env file.
amount : (float) amount. If not set, your strategy qty will be sent.
order_name : (string) order_name. The default name is "Order".
Returns: (string) A string containing the formatted webhook message.
sell_message(password, percent, order_name) Make a sell message for TradingHook.
Parameters:
password : (string) password that you set in .env file.
percent : (string) what percentage of your quantity you want to sell.
order_name : (string) order_name. The default name is "Order".
Returns: (string) A string containing the formatted webhook message.
You can use TradingHook WebServer open source code in github(github.com)