There is one unpleasant fact for you to take into consideration about the margin call Forex. You might not even receive the margin call before your positions are liquidated. If the money in your account falls under the margin requirements, your broker will close some or all positions, as we have specified earlier in this article. This can actually help prevent your account from falling into a negative balance.
Margins are a hotly debated topic. Some traders argue that too much margin is very dangerous, however it all depends on trading style and the amount of trading experience one has. If you are going to trade on a margin account, it is important that you know what your broker's policies are on margin accounts, and that you fully understand and are comfortable with the risks involved. Be careful to avoid a Forex margin call.
The script is currently hardcoded to generate forex data for the entire month of January 2014. It uses the Python calendar library in order to ascertain business days (although I haven't excluded holidays yet) and then generates a set of files of the form BBBQQQ_YYYYMMDD.csv, where BBBQQQ will be the specified currency pair (e.g. GBPUSD) and YYYYMMDD is the specified date (e.g. 20140112).
As we've already stated, trading on margin is trading on money borrowed from your broker. Each time you open a trade on margin, your broker automatically allocates the required margin from your existing funds in the trading account in order to back the margin trade. The precise amount of allocated funds depends on the leverage ratio used on your account.
If traders are positive on the prospects for the Yen, they would expect the number on the right to go down – i.e. the Yen would be getting stronger against the Dollar. Traders would be buying less Yen with a Dollar as the Yen got stronger. Similarly, if the Yen was expected to weaken, forex traders would expect the Yen number to go up, reflecting the fact that the dollar could buy more yen.
Slippage Handling - The system is currently generating a lot of slippage due to the high-frequency nature of the tick data provided from OANDA. This means that the portfolio balance calculated locally is not reflecting the balance calculated by OANDA. Until correct event-handling and slippage adjustment is carried out, this will mean that a backtest will not correctly reflect reality.
Let’s cover this with an example. If you have $1,000 in your trading account and use a leverage of 1:100 you could theoretically open a position size of $100,000. However, by doing so, your entire trading account would be allocated as the required margin for the trade, and even a single price tick against you would lead to a margin call. There would be no free margin to withstand any negative price fluctuation.
The "philosophy" of the forex trading system, as with the rest of the QuantStart site, is to try and mimic real-life trading as much as possible in our backtesting. This means including the details that are often excluded from more "research oriented" backtesting situations. Latency, server outages, automation, monitoring, realistic transaction costs will all be included within the models to give us a good idea of how well a strategy is likely to perform.
Free Margin – Your free margin represents your total equity minus any margin used for leveraged trades. For example, if your equity is $1,000 and your used margin is $100, your free margin would amount to $900. Following your free margin is extremely important, as it is used to withstand negative price fluctuations from your open trades and to open new leveraged trades. It’s important to understand that your free margin increases with profitable positions, but decreases with your losing positions. Once the free margin drops to zero or below, your broker will activate the so-called margin call and close all your open positions at the current market rate, in order to prevent your equity from falling below the required margin.
Now, let’s say you open a trade worth $50,000 with the same trading account size and leverage ratio. Your required margin for this trade would be $500 (1% of your position size), and your free margin would now also amount to $500. In other words, you could withstand a negative price fluctuation of $500 until your free margin falls to zero and causes a margin call. Your position size of $50,000 could only fall to $49,500 – this would be the largest loss your trading account could withstand.
In particular I've made the interface for beginning a new backtest a lot simpler by encapsulating a lot of the "boilerplate" code into a new Backtest class. I've also modified the system to be fully workable with multiple currency pairs. In this article I'll describe the new interface and show the usual Moving Average Crossover example on both GBP/USD and EUR/USD.
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.
Trading on margin is extremely popular among retail Forex traders. It allows you to open a much larger position than your initial trading account would otherwise allow, by allocating only a small portion of your trading account as the margin, or collateral for the trade. Trading on margin also carries certain risks, as both your profits and losses are magnified.
In a margin account, the broker uses the $1,000 as a security deposit of sorts. If the investor's position worsens and his or her losses approach $1,000, the broker may initiate a margin call. When this occurs, the broker will usually instruct the investor to either deposit more money into the account or to close out the position to limit the risk to both parties.
The currency exchange rate is the rate at which one currency can be exchanged for another. It is always quoted in pairs like the EUR/USD (the Euro and the US Dollar). Exchange rates fluctuate based on economic factors like inflation, industrial production and geopolitical events. These factors will influence whether you buy or sell a currency pair.
If you sell a security short, you must have sufficient equity in your account to cover any fees associated with borrowing the security. If you borrow the security through us, we will borrow the security on your behalf and your account must have sufficient collateral to cover the margin requirements of the short sale. To cover administrative fees and stock borrowing fees, we must post 102% of the value of the security borrowed as collateral with the lender. In instances in which the security shorted is hard to borrow, borrowing fees charged by the lender may be so high (greater than the interest earned) that the short seller must pay additional interest for the privilege of borrowing a security. Customers may view the indicative short stock interest rates for a specific stock through the Short Stock (SLB) Availability tool located in the Tools section of their Account Management page. For more information concerning shorting stocks and associated fees, visit our Stock Shorting page.