Page 1 of 1

Coding: Account Margin used %

Posted: Fri Feb 24, 2017 6:39 am
by borgesr
Dear Mladen,

How do I calculate if 20% of the account margin (AccountMargin()) has already been used?
If 20% of the margin has already been used do not release new orders.

Thank you,
Rogério

Coding: Account Margin used %

Posted: Fri Feb 24, 2017 7:12 am
by mladen
borgesr wrote:Dear Mladen,

How do I calculate if 20% of the account margin (AccountMargin()) has already been used?
If 20% of the margin has already been used do not release new orders.

Thank you,
Rogério
For any orders or just for the specific set of orders (created by specific EA, for example)?

Coding: Account Margin used %

Posted: Fri Feb 24, 2017 7:27 am
by borgesr
Hi Mladen,
For orders that correspond to the magic number  created by specific EA.

Thank you,
Rogério

Coding: Account Margin used %

Posted: Fri Feb 24, 2017 8:00 am
by mladen
borgesr wrote:Hi Mladen,
For orders that correspond to the magic number  created by specific EA.

Thank you,
Rogério
Not sure that it can be done - the way how brokers calculate the margin used when you open an order differs from broker to broker, so we do not have an universal way to "reconstruct" it for the moment when the order was opened, and, hence, we can not sum just a certain set of orders for that purpose

Coding: Account Margin used %

Posted: Fri Feb 24, 2017 8:05 am
by borgesr
Is it possible to know what percentage of the margin used is independent of the order?

Thank you,
Rogério

Re: Coding: Account Margin used %

Posted: Fri Feb 24, 2017 8:09 am
by mladen
borgesr wrote: Fri Feb 24, 2017 8:05 am Is it possible to know what percentage of the margin used is independent of the order?

Thank you,
Rogério
You have the AccountMargin() and AccountFreeMargin() functions - those can be used for that