Each time you open a new trade, calculate how much free margin you would need to use if the trade drops to its stop loss level. In other words, if your free margin is currently $500, but your potential losses of a trade are $700 (if the trade hits stop loss), you could be in trouble. In these situations, either close some of your open positions, or decrease your position sizes in order to free up additional free margin.
Let's presume that the market keeps on going against you. In this case, the broker will simply have no choice but to shut down all your losing positions. This limit is referred to as a stop out level. For example, when the stop out level is established at 5% by a broker, the trading platform will start closing your losing positions automatically if your margin level reaches 5%. It is important to note that it starts closing from the biggest losing position.
We also apply a concentrated margining requirement to Margin accounts. An account's two largest positions and their underlying derivatives will be re-valued using the worst case scenario within a +/- 30% scanning range. The remaining positions will be re-valued based upon a move of +/-5%. If the concentrated margining requirement exceeds that of the standard rules based margin required, then the newly calculated concentrated margin requirement will be applied to the account.
This material does not contain and should not be construed as containing investment advice, investment recommendations, an offer of or solicitation for any transactions in financial instruments. Please note that such trading analysis is not a reliable indicator for any current or future performance, as circumstances may change over time. Before making any investment decisions, you should seek advice from independent financial advisors to ensure you understand the risks.
Just like securities, commodities have required initial and maintenance margins. These are typically set by the individual exchanges as a percentage of the current value of a futures contract, based on the volatility and price of the contract. The initial margin requirement for a futures contract is the amount of money you must put up as collateral to open position on the contract. To be able to buy a futures contract, you must meet the initial margin requirement, which means that you must deposit or already have that amount of money in your account.
Multiple Currency Pairs - Similarly we need to support the major currency pairs beyond "Cable" (GBP/USD). There are two aspects to this. The first is to correctly handle the calculations when neither the base or quote of a currency pair is equal to the account denomination currency. The second aspect is to support multiple positions so that we can trade a portfolio of currency pairs.
Local Portfolio Handling - In my opinion carrying out a backtest that inflates strategy performance due to unrealistic assumptions is annoying at best and extremely unprofitable at worst! Introducing a local portfolio object that replicates the OANDA calculations means that we can check our internal calculations while carrying out practice trading, which gives us greater confidence when we later use this same portfolio object for backtesting on historical data.