#### Topic: [Solved] Trade Percent Equity Issue

I just started a new strategy and realized that the trade size was not correct for the strategy properties. The trade size was set to 40% account equity.
The beginning equity was \$3500.
Leverage is set to 1/20.
EUR/USD price = 1.33536

Trade size in USD should have been:
equity*ratio(leverage)*Percent
3500*20*.4 = \$28,000
Converted to EUR trade size:
USD trade size * (1/EURUSD Price)
28000*(1/1.3353) = 20,969 EUR (or 20,000 rounded down to lots)

which comes out to: 52000 * (EURUSD price) 1.3353 = \$69,435 which is 100% equity traded at 1/20 leverage (3500*20=\$70,000).

Any help on what might be wrong? (and yes I know the dangers of high stop/loss and low take profit, and high leverage :-). Everything you usually do not want in a strategy )

Here are screen shots from the trade and strategy.

FST Version:

FST Transaction:

FST Settings:

#### Re: [Solved] Trade Percent Equity Issue

The formula is:

``````        /// <summary>
///     Calculates the trading size in normalized lots
/// </summary>
private double TradingSize(double size)
{
if (Data.Strategy.UseAccountPercentEntry)
size = (size/100)*Data.AccountEquity/Data.InstrProperties.MarginRequired;

size = NormalizeEntrySize(size);

return size;
}``````

You can see MarginRequired in Market Info:

FST opens percent of maximum possible entry amount. In you case 40%.
MarginRequired shows how much is required for opening of 1 lot.

Are you sure the leverage is 1/20. Please post all Market info and Account info to check the calculations.

#### Re: [Solved] Trade Percent Equity Issue

Thank You Popov! I should be more cautious of saying bug in my post as the code has been very stable for me. It is always me not understanding something.

The leverage was the key. See my account info below, FST -> 1:50, Oanda ->1:20. There is a disconnect. How can I change the leverage so FST knows it is at 1:20? I assumed it would just pick it up from Oanda/MT4. I will try to reset some things to see if I can get the to leverages matched up.

On another note: can I change the title of the original post because it isn't a bug?

FST

OANDA

#### Re: [Solved] Trade Percent Equity Issue

I rebooted MT4 and FST and the leverage was picked up correctly.  I must have had the leverage changed on Oanda at some point while migrating strategies. Is there a way to close out this post on change the title.

#### Re: [Solved] Trade Percent Equity Issue

ultplyr wrote:

Is there a way to close out this post on change the title.

I changed the the title, are you happy with it? We can put whatever you want there

Respect for insisting clearing out the "bug" word

#### Re: [Solved] Trade Percent Equity Issue

You cannot set trade settings or symbol settings. They all comes from the broker.
FST even reads most important param at every tick.

Leverage is read at connection time. It can be reread when you press Market info or Account Info buttons.

#### Re: [Solved] Trade Percent Equity Issue

footon wrote:
ultplyr wrote:

Is there a way to close out this post on change the title.

I changed the the title, are you happy with it? We can put whatever you want there

Respect for insisting clearing out the "bug" word

I do not think we are finding a lot of 'bugs' for many months.... my impression is that the code is pretty tight. Three years or so  ago perhaps there were some errors, not many recently.

#### Re: [Solved] Trade Percent Equity Issue

Great title change. I appreciate everyone's quick response!