Margin Calculation
How the margin of a ticket is dynamically calculated independently.
Math behind Cosy Traader
You may find some holy grail EAs on the market released as black boxes. However, Cozy Trader is designed to be a copilot and assistant to make your life easier. Therefore, we aim to explain how things are calculated and how your trades will be executed. You can skip this chapter if you only want to use this tool without thinking too much about the math and calculations behind it.
Margin calculation
How we calculate the margin dynamically when there are multiple pending ticket?
Since your pending order may be triggered and converted to a market order at any time, we designed the margin calculation feature to be a dynamic process. The principle of this process is to avoid letting the pending orders occupy the free margin before they have been converted into market orders. In this way, multiple pending orders with large lot sizes can co-exist until some of them are triggered and the free margin is decreased. Then, the lot sizes of the remaining pending orders will be reconsidered and may be reduced.
There are two main points we check regarding free margin:
- Ticket placement margin: Every time you place a pending order, we calculate whether there is enough free margin to execute the order. If there isn't enough free margin available, we may reduce the lot size or adjust the entry position to a higher retracement ratio (e.g., from 78.6% to 61.8%), depending on your parameter settings.
- Price fluctuation margin: In addition to the ticket placement margin, we reserve some margin for price fluctuations before the stop-loss is triggered. We calculate the price fluctuation margin by multiplying the
money-to-risk-per-ticket
by theforce-liquidation-fold
for your pending order.
The total margin for each ticket will be:
Ticket_placement_margin
+ Price_fluctuation_margin
For example, if you trade with an account with:
Leverage | 100x |
---|---|
money-to-risk-per-ticket | 10 USD |
force-liquidation-fold | 2.5x |
Calculated lot size | 0.10 lot |
The total amount of money we will reserve for this order will be:
- Ticket placement margin: 110 USD for 0.1 lots with 100x leverage.
- Price fluctuation margin: 25 USD (10 * 2.5) for the price fluctuation before hitting the close price stop-loss.
The total of 135 USD is the margin you need to place this order. At the moment you send the order, if you have free margin greater than 135 USD, Cozy Trader will maintain the lot size at the calculated amount of 0.10 lots. If the free margin is less than 135 USD, Cozy Trader may either adjust the Fibonacci retracement ratio or reduce the lot size, depending on your system settings.