Hi guys, wondering if anyone can help with this problem:
I want to adjust the "maintenance margin" available on an account - basically adjusting when the "RuinStop" occurs in the backtester, and I want to have it account for large price swings that happen during open trades aka open-trade drawdowns. Another adequete method would be to define the largest % drawdown allowable on the account.
The problem I'm having is this:
I want to trading volatile instruments with approx. leverage of 300% of account balance (MarginDeposit = -33), and a maintenance margin requirement of 15% (i.e. if the value of my account minus the losses of open positions goes below 15% of the total margin account value, the position gets forced closed and the losses are taken out of my account).
For example, with a $10,000 account, I can open positions up to a total value of $30,000, and if the losses on the open positions exceed $8500 (100% - 85% = 15% maintenance margin), I get margin called - the exchange force closes the positions, and there is $1500 left in the account.
I want to be sure that the parameters I get from the optimizations are "safe" (or at least as safe as possible) and won't result in a margin call when running the strategy live.
Currently I am optimizing my strategy with the following parameters:
SetOption("InitialEquity", 10000 ); // set initial equity = 10K SetOption("FuturesMode", True ); SetPositionSize(100, spsPercentOfEquity ); MarginDeposit= -33;
Unfortunately, the built-in RuinStop doesn't seem to happen unless my losses are something like 200% of the account balance. So, where the exchange would have margin called me when (Balance - Losses) = 0.15*Balance, Amibroker will not produce the RuinStop unless the Cumulative Profit goes below 0, and doesn't seem to account for open-trade drawdowns (if a price spike results in a margin call while the trade is still open). To get around this, I've been optimizing using a much higher leverage (like -20 MarginDeposit instead of -33) but this isn't a good solution.
To illustrate the problem more clearly:
In one optimization, the optimal settings produced a trade that opened a long at $0.95, the price dipped to a low of $0.45, then recovered, and the long was closed at $1.05. In the backtester, this shows as a gain, since the trade opened at .95 and closed at 1.05. However, the dip from 0.95 to 0.45 at 300% leverage would have resulted in my account balance going below 15% (actually, far below 0), and I would have been margin called.
Is there a way to change this behavior?
Thank you for your help!