The "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:

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.
    _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.
    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 is an user-defined type (UDT) that represents the parameters required for a Mizar DCA bot.
    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.

파인 라이브러리

트레이딩뷰 정신에 따라 오써는 이 파인 코드를 오픈 소스 라이브러리로 퍼블리쉬하여 당사 커뮤니티의 다른 파인 프로그래머들이 쓸 수 있도록 하였습니다. 오써에게 찬사를! 여러분은 이 라이브러리를 프라이빗 또는 오픈 소스 퍼블리케이션에 쓸 수 있지만 퍼블리케이션에 재사용은 하우스룰을 따릅니다.


이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

이 라이브러리를 쓰시겠습니까?

텍스트를 클립보드에 카피한 뒤 님의 스크립트에 붙여 넣기.