Margin Rate box in setting

hello everyone:

I am new to Amibroker but not new to trading. I want to write a system for CFD with 10% margin, so at the "Account Margin" box, I put '10', but how about the Margin Rate [%] box? I couldn't find it's documentation anywhere online and I can't leave it blank, it requirs a number. Pleae help. (see attached picture)


1 Like

@riverculture The only information I am aware of is in the DevLog pages when that feature was introduced (v5.93),


Thank you for your reply Portfoliobuilder, I read that too, but I really have no idea what it is talking about. Is there anyway to contact the technical people inside Amibroker directly? The customer service email doesn't seem to respond efficiently, they should really improve their after sale services.

@riverculture contact: support-at-amibroker-dot-com
It might be worth remembering that AmiBroker is based in Europe and currently it is 4 a.m there.

Perhaps in your country they use a different word. When you buy securities on margin , you'll pay back the money you borrow plus interest , which varies depending on the amount of the loan and the brokerage firm that you use. So it is the interest rate on your margin "loan". For example here is a comparison of some U.S. brokers,

Ok, your explanation is crystal clear , if it's the interest rate on the margin loan, then what about the other box "fixed annual interest", what is the difference between them? thank you again

Oh, I think I got it. The fixed interest rate and dynamic interest rates are the interest rates set by "Central Banks" . Am I right?

@riverculture you are close to right. These interest rates are there to enable you to backtest your portfolio in the way you prefer. You can earn interest on your cash balance, and so enter the interest rate your broker or bank is paying you (and that is usually related to the Central Bank interest rates). Or you can purchase a security like a money market mutual fund with your spare cash, etc.

Some related discussion is had in this previous thread,

Welcome to AmiBroker and good luck.

1 Like

Thank you so much, your quick responses are definitely a big welcome to me.

You are on wrong track as those settings are for trading stocks borrowing money (margin rate is not margin deposit but margin interest). Remove settings. (BTW it is documented online here.)

You are trading CFDs so you have to read here instead.

As for percent margin deposit settings look here, for example.

MarginDeposit is set in Information window of AB.


MarginDeposit can be type array or number and can be set via AFL too.

Array example:

MarginDeposit = Iif(DateNum() < 1160101, -50, -40);

As @fxshrat wrote, this setting is only for stock margin account. For all other instruments that are leveraged by themselves (forex, futures, cfds, etc) you should use Futures mode.

1 Like

Thank you for pointing this out, I have a few more questions hope you don't mind, you said "remove settings", how?
I checked "Future Mode" box, but the Margin Rate and Account Margin boxes do not become greyed out, and they can't be empty either. (see picture below, I am confused, I believe they are mutually exclusive). Or should I just ignore the numbers in Margin Rate and Account Margin boxes once the Future Mode box is checked?

Thank you very much again .

By "remove" I meant to remove your settings by restoring default ones.

Have you not read what is written below of Account margin setting? Do you not see it?
It says there "100 means no margin account". Also manual is telling what is default one and what it means:

"Account margin setting defines percentage margin requirement for entire account . The default value of Account margin is 100. This means that you have to provide 100% funds to enter the trade, and this is the way how..."

Quote source:

So set Account margin to 100 and Margin Rate to zero. Those are the default ones (though I believe that if Account Margin is 100 then margin rate is not applied anyway since then there is not a margin account).

And once again Account margin is for trading stocks (borrowing money from your broker to buy stocks).


For more than 90% of settings there is AFL SetOption field. So you can override UI settings via AFL in most cases.

SetOption("AccountMargin", 100);
SetOption("FuturesMode", True);

YES, I KNEW at the very beginning 100 means no margin. However, I believe this setting should not be applied at all, default or otherwise. that's where my confusion comes from.

Thank you so much for explaining, you did explain very clearly how this works, if that is the case than it's potentially a problem of the design of Amibroker's UI, it's illogic and unintuitive.

  1. If by activating future mode, it will make it not a margin loan trading system, then the Margin Rate and Account Margin boxes should be greyed out. But since Margin Rate and Account Margin boxes are not greyed out, it implies that they apply. I suspect, even if the future mode is activated, the numbers in Margin Rate and Account Margin boxes still apply. For example, after activating Future Mode and setting Account Margin to 50, it will mean that in this system, 1/2 of the money is borrowed from traditional margin loan, say $10k, then the CFD trading will be utilising the total money available ($20k), and if the CFD margin deposit is 10%, it will make the total buying power of $200k. But in real world, it doesn't make sense, as margin loan requires the underline stock as security. Hence, my conclusion, all the margin loan related boxes should be greyed out after future mode is activated, not leaving them available for modification (and setting it back to default doesn't make it logically correct).

  2. CFDs do use margin and they work almost identical to traditional margin loans, if Ambroker want to make them distinctively separate, then there should be a better way of design and/or documentation.

If I am wrong, I welcome corrections, other point of views or arguments.

Thank you again

Nonsense. These two (account margin and futures mode) are separate and independent features.

Your speculations and claims are typical example of Dunning Kruger effect. Before claiming "problem of the design" it is advised to first learn the program for one year, once you do, you will know how it works and start to appreciate how logical and powerful it is.