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;
}