DCA Liquidation Calculation [ChartPrime]The DCA Liquidation Calculator is a powerful table indicator designed for both manual and bot-assisted traders who practice Dollar Cost Averaging (DCA). Its primary objective is to help traders avoid getting liquidated and make informed decisions when managing their positions. This comprehensive table indicator provides essential information to DCA traders, enabling them to plan their trades effectively and mitigate potential risks of liquidation.
Key Features:
Liquidation Price Awareness: The DCA Liquidation Calculator calculates and displays the liquidation price for each trade within your position. This critical information empowers traders to set appropriate stop-loss levels and avoid being liquidated in adverse market conditions, especially in leveraged trading scenarios.
DCA Recommendations: Whether you are executing DCA manually or using a trading bot, the DCA Liquidation Calculator offers valuable guidance. It suggests optimal entry prices and provides insights into the percentage deviation from the current market price, helping traders make well-timed and well-informed DCA decisions.
Position Sizing: Proper position sizing is essential for risk management. The DCA Liquidation Calculator helps traders determine the percentage of capital to allocate to each trade based on the provided insights. By using the recommended position sizing, traders can protect their capital and potentially maximize profits.
Profit and Loss Visualization: Gain real-time visibility into your Profit and Loss (PnL) with the DCA Liquidation Calculator. This feature allows you to monitor your trades' performance, enabling you to adapt your strategies as needed and make data-driven decisions.
Margin Call Indicators: Anticipating potential margin calls is crucial for maintaining a healthy trading account. The DCA Liquidation Calculator's smart analysis helps you identify and manage potential margin call situations, reducing the risk of account liquidation.
Capital Requirements: Before entering a trade, it's vital to know the required capital. The DCA Liquidation Calculator provides you with this information, ensuring you are adequately prepared to execute your trades without overextending your resources.
Maximum Trade Limit: Considering your available capital, the DCA Liquidation Calculator helps you determine the maximum number of trades you can enter. This feature ensures you maintain a disciplined and sustainable trading approach aligned with your financial capabilities.
Color-Coded Risk Indicators:
Green Liquidation Price Cell: Indicates that the position is considered safe from liquidation at the given parameters.
Yellow Liquidation Price Cell: Warns traders of potential liquidation risk. Exercise caution and monitor the trade closely to avoid undesirable outcomes.
Purple Liquidation Price Cell: Shows the liquidation price, but it does not necessarily indicate an imminent liquidation. Use this information to make prudent risk management decisions.
Red Row: Signals that the trade cannot be executed due to insufficient capital. Consider alternative strategies or ensure adequate capitalization before proceeding.
Settings explained:
In conclusion, the DCA Liquidation Calculator equips traders with essential tools to make well-calculated decisions, minimize liquidation risks, and optimize their Dollar Cost Averaging strategy. By offering comprehensive insights into your trading position, this indicator empowers you to navigate the markets with confidence and increase your potential for successful and sustainable trading.
DCA-BOT
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.