Now that we have discussed the longer term plan I want to present some of the changes I have made to the code since diary entry #2. In particular, I want to describe how I modified the code to handle the Decimal data-type instead of using floating point storage. This is an extremely important change as floating point representations are a substantial source of long-term error in portfolio and order management systems.
Systems that derive risk-based margin requirements deliver adequate assessments of the risk for complex derivative portfolios under small/moderate move scenarios. Such systems are less comprehensive when considering large moves in the price of the underlying stock or future. We have enhanced the basic exchange margin models with algorithms that consider the portfolio impact of larger moves up 30% (or even higher for extremely volatile stocks). This 'Extreme Margin Model' may increase the margin requirement for portfolios with net short options positions, and is particularly sensitive to short positions in far out-of-the-money options.
One of the unique features of TradingDiary Pro which you cannot find in any trading journal software is the options strategy support. TradingDiary Pro is the perfect solution for an options trading journal and tracking your stock and futures options strategies. What is an options strategy? Options strategy is simultaneously buying or selling one or […]
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.

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.

To get started, investors interested in trading in the forex markets must first sign up with either a regular broker or an online forex discount broker. Once an investor finds a proper broker, a margin account must be set up. A forex margin account is very similar to an equities margin account – the investor is taking a short-term loan from the broker. The loan is equal to the amount of leverage taken on by the investor.

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.
Borrowing money to purchase securities is known as "buying on margin". When an investor borrows money from his broker to buy a stock, he must open a margin account with his broker, sign a related agreement and abide by the broker's margin requirements. The loan in the account is collateralized by investor's securities and cash. If the value of the stock drops too much, the investor must deposit more cash in his account, or sell a portion of the stock.
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.
Maintenance margin for commodities is the amount that you must maintain in your account to support the futures contract and represents the lowest level to which your account can drop before you must deposit additional funds. Commodities positions are marked to market daily, with your account adjusted for any profit or loss that occurs. Because the price of underlying commodities fluctuates, it is possible that the value of the commodity may decline to the point at which your account balance falls below the required maintenance margin. If this happens, brokers typically make a margin call, which means you must deposit additional funds to meet the margin requirement.
Trading on margin refers to trading on money borrowed from your broker in order to substantially increase your market exposure. When opening a margin trade, your broker lends you a certain sum of money depending on the leverage ratio used, and allocates a small portion of your trading account as the collateral, or margin for that trade. The remaining funds in your trading account will act as your free margin, which can be used to withstand negative price fluctuations from your existing leveraged positions, or to open new leveraged trades. The relation between your free margin and other important elements of your trading account, such as your balance and equity, will be explained later. For now, it’s important to understand the meaning of margin in Forex.