Topic: How to calculate margin?
1) How to calculate margin?;
2) Why does the program show opening 0.01 lot, and actually calculates the margin, spread and profit as of 1 lot? (XAUUSD)
Create and Test Forex Strategies
You are not logged in. Please login or register.
Forex Software → Forex Strategy Builder (legacy) → How to calculate margin?
1) How to calculate margin?;
2) Why does the program show opening 0.01 lot, and actually calculates the margin, spread and profit as of 1 lot? (XAUUSD)
1) How to calculate margin?;
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;
}
You can check the source code here: https://github.com/PopovMP/Forex-Strate … tistics.cs Line: 757
2) Why does the program show opening 0.01 lot, and actually calculates the margin, spread and profit as of 1 lot? (XAUUSD)
I don't think the program does that. As you see in the formula:
Required Margin = Lots * Lot Size * Exchange Rate / Leverage;
So if you set lots = 0.01, it must not use 1.0. Probably you are missing some of the other parameters.
Can you post the exact numbers?
Forex Software → Forex Strategy Builder (legacy) → How to calculate margin?
Powered by PunBB, supported by Informer Technologies, Inc.