Having a brain fart on figuring out margin used based on stop?

Discussion in 'Forex' started by Pelt, Jun 9, 2022.

  1. easymon1

    easymon1

    What percent of your account value do you want to apply to a single trade?
    and
    What percent of your account value do you want to risk on a single trade?
     
    #31     Jun 10, 2022
  2. Pelt

    Pelt

    Let's say for this example, if price moves 30pips against my entry, I want my USED MARGIN to be at 10%.
     
    #32     Jun 10, 2022
  3. easymon1

    easymon1

    Are you willing to apply 100% of your account value to a single trade? This is not equal to the risk amount.

    1) What percent of your account value do you want to apply to a single trade?
    and
    2) What percent of your account value do you want to risk on a single trade?
     
    #33     Jun 10, 2022
  4. Pelt

    Pelt

    Is the percent of the account value the same as margin used?

    I do not think they are?

    I do not want to solve for a percent of my account value, I know how to do this.

    I want to solve for margin used based on a unrealized profit/loss.
     
    #34     Jun 10, 2022
  5. Pelt

    Pelt

    This should be simple. There has to be a simple equation for this.

    I'm trying to reword the problem, or simplify it, I really just don't think I am able to communicate what I am after... I will try this way.

    Everyone who has traded forex, will have noticed in their platform, a metric called, "Margin Used."

    After opening a position, this value will change, as your unrealized PnL changes. My question is simply... How is this number calculated?
     
    #35     Jun 10, 2022
  6. cesfx

    cesfx

    Is this metric a % of margin used from your total available margin?

    % = [ (Units : 50 leverage) : {50 leva * [(initial balance) + (-PnL) - (Units : 50 leva)]} ] x10



    which simplified should be something like:

    % = [ ($ margin required) : avail $ buying power (or available leveraged $ capital) ] x10
     
    #36     Jun 10, 2022
  7. Pelt

    Pelt

    My man. Your examples have been helpful in figuring this out. Some of the notation you were using I was confused by, but nonetheless, I will post the solution I came up with shortly. I think I managed to distill it down to something pretty simple, and might be the same thing you posted, but not sure?
     
    #37     Jun 10, 2022
  8. cesfx

    cesfx

    It was fun.

    Looking at it now, it's (PnL) not (-PnL)... I did some copy and paste and didn't edit well

    % = [ (Units : 50 leverage) : {50 leva * [(initial balance) + (PnL) - (Units : 50 leva)]} ] x10

    If it's a percentage of total avail margin...

    ($ margin required for the trade : total $ available margin on balance considering PnL change) x10
     
    #38     Jun 10, 2022
  9. Pelt

    Pelt

    So this is what I came up with.

    I threw some orders in the market Friday, and was taking screenshots as price moved around, so that I could compare to whatever I wound up with. I will try again on Monday to be sure its working the way I think. In the attached image, you can see to different states of the trade, initially where it was down -5pips, and then up 13pips, so two different PnLs.


    The Inputs are:
    Pair: Aud/Usd
    Balance = B = $35.23
    Trade Price = Price = p = 0.7115
    Stop Size = SS = 0.00026
    Units = U = 200
    Margin = m = 0.03 / 3%

    The Outputs are:
    Stop Cost = SC = Units * StopSize = 200 * 0.00026 = $0.05
    Margin Used = mu = Units * Margin * Price = 200 * 0.03 * 0.7115 = $4.27
    Nav(Net Asset Value)/Equity = NAV = Balance + Stop Cost = $35.18
    Margin Percentage(Percentage of your Used Margin) = MP = Margin Used ÷ NAV = 12%

    The Red line above is the one I am after. So if I were to place this trade, I'd know at MAX, I would use 12% of my margin if it runs to my stop. This way, if I happen to have variable stop sizes, I can always use the same Margin amount in my account. You can imagine, if you have a typical stop of 40 pips, and then for whatever reason you have a 5 pip stop... even though you can risk the same dollar amount, the margin used will be wildly different. This will affect your ability to open/maintain additional positions.

    The equations I used are:
    MP = (mu ÷ NAV) = (U * m * p) ÷ (B + SC) = (U * m * p) ÷ (B + U*SS)

    Here I solve for U, as I want to know how many Units to buy to hold a max margin of my account.
    U = (B * MP) ÷ (m*p - MP * SS) = (35.23 * 0.12) ÷ (0.03*0.7115 - 0.12* 0.00026) =198

    I checked this for the other picture also, when it was in profit, and it matches also.

    Also to note... all the inputs and outputs used, where just to solve for what the formula should be. For actual trading, the inputs would be the desire max margin, and not the Units, as the units are what is being solved for.
     
    Last edited: Jun 10, 2022
    #39     Jun 10, 2022
    shuraver and cesfx like this.