General Topics
Technical Topics
Brokerage Firms
Community Lounge
Site Support

# Margin math

Discussion in 'Forex Trading' started by Rocko Bonaparte, Sep 30, 2012.

1. ### Rocko Bonaparte

I've been trying to hand calculate some backtest results from Amibroker when doing a 100:1 margin spot forex test. This is the best I can come up with for some of the results. I have questions about most of it so I hoped some regulars can help me out.

Let's say I'm looking at EURUSD. On the day I enter a long position, it is going at \$1.21800. So I need \$1.21800 dollars to get a euro. However, it trades in lots of 100 as its base. So I need \$121.80 dollars to get 100
euros. But the base currency is USD so I basically pay \$100.00 to get, like 82.10... euros.

I want to enter \$100k into the long position, using 100:1 margin. Here's where I get confused . The Amibroker instructions are to enter a margin deposit of 1,000 for 100:1, but I would have figured 100. When I did my math with just 100, it didn't work, and I had to enter 1,000. So we'll continue with that and maybe change this story later if somebody comments otherwise.

First, how many contracts can I do with that? with \$100,000 I assume \$100,000 divided by 1,000, which is 100 contracts. But due to some commissions at most I can reason is 99 contracts.

Say EURUSD goes up a pip. So it's now \$1.21801. My profit would be:

99 * (1.21801 - 1.21800) * 100 * 1000 = \$99. Just raking it in there. (It's just for this situation. )

Is all this right? Any idea why with the margin it's x1000 instead of x100? Right now my own math correlates to amibroker backtest results with these numbers, but only because of these numbers.

2. ### oldtime

also, the accrued interest gets you a little, not sure where you are getting 100:1 unless you are non USA.

Kind of a moot point, since what they will give you has nothing to do with how much you will accept

unless you are just dreaming on a Sunday afternoon

I was just thinking about the same thing

Imagine I walked into the Trump Casino on the day it opened in Atlantic City, and not a single 7 got rolled for 24 hours

How much could I have made?

3. ### oldtime

otherwise,

It depends on what your broker will give you. In USA it will be either 50 to one or 40 to one.

My broker is 40 to one.

so with 10k in my account (which is the minimum) in USD, I can put on 400k EUR, minus the spread, commission and interest

4. ### Random.Capital

That's a great line.

Applies to so much of life.

5. ### oldtime

hey random, how you been? Haven't heard from you in a while. piezoe turned me on to some George Soros lectures, that is my plan today, to bend my hard core right wing liberterian mind out of it's vice.

When I was a kid they had a band called the "Mind Benders" I think their big hit was "Red Rubber Ball." It didn't matter who or what you actually were, you couldn't quite be offended by them.

Even my mother said, "Ok, now that one I like."

6. ### Rocko Bonaparte

I had hoped using 100:1 would make the numbers a little bit rounder.

7. ### oldtime

yeah, it's now illegal in usa, you can still get it with a non usa broker

try 50 to one, it's not really that much less round

8. ### Rocko Bonaparte

Guys I'm just trying to figure out how the math here works. What leverage I use to fill in the blanks is not the issue.

Fine, make it 50:1

The formula for calculating a profit, without considering commissions, the spread, or what not, appears to be:

contacts * (entrance price - exit price) * 100 in a lot * margin depositor

So before with 100:1 margin with 99 EURUSD contracts, entering at 1.21800 and exiting 1.21801, I was using this formula:

99 * (1.21801 - 1.21800) * 100 * 1000

So I assume with 50:1 margin it becomes:

99 * (1.21801 - 1.21800) * 100 * 500

I'm trying to understand why 50:1 means a margin deposit of 500, instead of just 50. Is something wrong there?

9. ### KingJedi

Margin only effects leverage

Profit for one lot over 1 pip is \$100,000 x 0.0001 = \$10

Now to use part of oldtime's example.. if you have \$10k in your account you end up using 10:1 leverage to start out with.. this will either shrink or grow depending if you make or lose money on your position

It also gets a little more complex when your account currency is not the same that you are trading in

10. ### Rocko Bonaparte

I'm adding in the math for margin calls and such so I'm starting to understand the parlance here. Like, what it means when people talk about margin required versus flat out talking about the leverage. And I can appreciate why 100:1, er 1% required is so crazy. I guess you can get a margin call just minutes afterwards, even if the trade was going to be perfectly fine over the planned position duration. It still makes for cleaner calculations when verifying formulas and code.

#10     Oct 5, 2012
ET IS FREE BECAUSE OF THE FINANCIAL SUPPORT FROM THESE COMPANIES: