<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — How to calculate margin?]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/4853/" />
	<updated>2014-06-21T11:43:01Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/4853/how-to-calculate-margin/</id>
		<entry>
			<title type="html"><![CDATA[Re: How to calculate margin?]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/25444/#p25444" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>1) How to calculate margin?;</p></blockquote></div><div class="codebox"><pre><code>        public static double RequiredMargin(double lots, int bar)
        {
            double amount = lots*InstrProperties.LotSize;
            double exchangeRate = Close[bar]/AccountExchangeRate(Close[bar]);
            double requiredMargin = amount*exchangeRate/Configs.Leverage;

            return requiredMargin;
        }</code></pre></div><p>You can check the source code here: <a href="https://github.com/PopovMP/Forex-Strategy-Builder/blob/master/Source/ForexStrategyBuilder/Backtester/BacktesterStatistics.cs">https://github.com/PopovMP/Forex-Strate … tistics.cs</a> Line: 757</p><br /><div class="quotebox"><blockquote><p>2) Why does the program show opening 0.01 lot, and actually calculates the margin, spread and profit as of 1 lot? (XAUUSD)</p></blockquote></div><p>I don&#039;t think the program does that. As you see in the formula:</p><p>Required Margin = Lots * Lot Size * Exchange Rate / Leverage;</p><br /><p>So if you set lots = 0.01, it must not use 1.0. Probably you are missing some of the other parameters.</p><br /><p>Can you post the exact numbers?</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2014-06-21T11:43:01Z</updated>
			<id>https://forexsb.com/forum/post/25444/#p25444</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How to calculate margin?]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/25443/#p25443" />
			<content type="html"><![CDATA[<p>1) How to calculate margin?;<br />2) Why does the program show opening 0.01 lot, and actually calculates the margin, spread and profit as of 1 lot? (XAUUSD)</p>]]></content>
			<author>
				<name><![CDATA[Pom-Pom]]></name>
				<uri>https://forexsb.com/forum/user/8168/</uri>
			</author>
			<updated>2014-06-21T10:52:52Z</updated>
			<id>https://forexsb.com/forum/post/25443/#p25443</id>
		</entry>
</feed>
