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.
Trading on margin can be a profitable Forex strategy, but it is important to understand all the possible risks. You should make sure you know how your margin account operates, and be sure to read the margin agreement between you and your selected broker. If there is anything you are unclear about in your agreement, ask questions and make sure everything is clear.
GUI Control and Reporting - Right now the system is completely console/command line based. At the very least we will need some basic charting to display backtest results. A more sophisticated system will incorporate summary statistics of trades, strategy-level performance metrics as well as overall portfolio performance. This GUI could be implemented using a cross-platform windowing system such as Qt or Tkinter. It could also be presented using a web-based front-end, utilising a web-framework such as Django.
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.

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.

These articles, on the other hand, discuss currency trading as buying and selling currency on the foreign exchange (or "Forex") market with the intent to make money, often called "speculative forex trading". XE does not offer speculative forex trading, nor do we recommend any firms that offer this service. These articles are provided for general information only.
This article will address several questions pertaining to Margin within Forex trading, such as: What is Margin? What is free margin in Forex?' and What is Margin level in Forex? Every broker has differing margin requirements and offers different things to traders, so it's good to understand how this works first, before you choose a broker and begin trading with a margin.
As part of the Universal Account service, we are authorized to automatically transfer funds as necessary between your securities account and your futures account in order to satisfy margin requirements in either account. You can configure how you want us to handle the transfer of excess funds between accounts on the Excess Funds Sweep page in Account Management: you can choose to sweep funds to the securities account, to the futures account, or you can choose to not sweep excess funds at all.

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.
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.
For those of you who are new to source version control you will probably want to read up on how git (and version control in general) works with the fantastic free ebook Pro Git. It is worth spending some time learning about source control as it will save you a huge amount of future headache if you spend a lot of time programming and updating projects!
In particular we will need strategy level metrics, including common risk/reward ratios such as the Sharpe Ratio, Information Ratio and Sortino Ratio. We will also need drawdown statistics including the distribution of the drawdowns, as well as descriptive stats such as maximum drawdown. Other useful metrics include the Compound Annual Growth Rate (CAGR) and total return.
In particular I would like to make the system a lot faster, since it will allow parameter searches to be carried out in a reasonable time. While Python is a great tool, it's one drawback is that it is relatively slow when compared to C/C++. Hence I will be carrying out a lot of profiling to try and improve the execution speed of both the backtest and the performance calculations.
© Forex Factory 2020.  All rights reserved.  The Forex Factory calendar changes frequently to reflect the latest information.  For the most up to date calendar, please visit  Forex Factory takes no responsibility for decisions based on this information, please see our terms of service at
Trading on margin can be a profitable Forex strategy, but it is important to understand all the possible risks. You should make sure you know how your margin account operates, and be sure to read the margin agreement between you and your selected broker. If there is anything you are unclear about in your agreement, ask questions and make sure everything is clear.
© 2019 Learn to Trade Pty Ltd (ACN:138178542, AFSL:339557) provides general information and educational courses and materials only. This is not an offer to buy/sell financial products. We do not provide personal advice nor do we consider the needs, objectives or circumstances of any individual. Financial products are complex and all entail risk of loss. Over-the-counter derivative and foreign exchange products are considered speculative because they are highly leveraged and carry risk of loss beyond your initial investment, hence should only be traded with capital you can afford to lose. Please ensure you obtain professional advice to ensure trading or investing in any financial products is suitable for your circumstances, and ensure you obtain, read and understand any applicable offer document.
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.
Forex margin is a good faith deposit that a trader puts up as collateral to initiate a trade. Essentially, it is the minimum amount that a trader needs in the trading account to open a new position. This is usually communicated as a percentage of the notional value (trade size) of the forex trade. The difference between the deposit and the full value of the trade is “borrowed” from the broker.
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.