Often, closing one losing position will take the margin level Forex higher than 5%, as it will release the margin of that position, so the total used margin will decrease and consequently the margin level will increase. The system often takes the margin level higher than 5%, by closing the biggest position first. If your other losing positions continue losing and the margin level reaches 5% once more, the system will just close another losing position.
So, for an investor who wants to trade $100,000, a 1% margin would mean that $1,000 needs to be deposited into the account. The remaining 99% is provided by the broker. No interest is paid directly on this borrowed amount, but if the investor does not close their position before the delivery date, it will have to be rolled over. In that case, interest may be charged depending on the investor's position (long or short) and the short-term interest rates of the underlying currencies.
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.
However, what must be remembered is that the majority of robots trade within a certain range. They make a particular amount of pips inside the tight range, during the slowest time on the Forex market, and they regularly set a few pip targets, and may not even use a stop-loss. They can be classed as successful, as they do tend to make profits in each trade, even if it is only a few.
Margin requirements for futures and futures options are established by each exchange through a calculation algorithm known as SPAN margining. SPAN (Standard Portfolio Analysis of Risk) evaluates overall portfolio risk by calculating the worst possible loss that a portfolio of derivative and physical instruments might reasonably incur over a specified time period (typically one trading day.) This is done by computing the gains and losses that the portfolio would incur under different market conditions. The most important part of the SPAN methodology is the SPAN risk array, a set of numeric values that indicate how a particular contract will gain or lose value under various conditions. Each condition is called a risk scenario. The numeric value for each risk scenario represents the gain or loss that that particular contract will experience for a particular combination of price (or underlying price) change, volatility change, and decrease in time to expiration.
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.