Margin Required Indicator

Hello all!

I have another indicator to share with everyone. With this one you specify the number of Lots, and it displays on the chart how much Free Margin is required to execute the position.

From the Oanda Margin Calculator

This calculation uses the following formula:

({BASE} / {Home Currency}) * units) / (margin ratio)

For example, suppose:

Home Currency = USD
Currency Pair = GBP/CHF
Base = GBP; Quote = CHF
Base / Home Currency = GBP/USD = 1.5819
Units = 1000
Margin Ratio = 20:1

Then, margin used:
= (1.5819 * 1000) / 20
= 79.095 USD

The calculation isn’t too complicated, but it does take time, so I wrote this indicator to know at a glance if I have enough margin to enter.

Grab it here MarginRequired.zip (12.8 KB), and let me know if you think it needs any changes or additional information.

Enjoy!

I assume its for mt4 only. I been looking for this for my ctrader platform

[QUOTE=“3xfx;714987”]I assume its for mt4 only. I been looking for this for my ctrader platform[/QUOTE]

It is just for MT4, but I will look into the logistics of writing the same for ctrader.

Took a little bit of learning, but here you go!

The same indicator, but for cTrader.
MarginRequired - cTrader.zip (3.95 KB)

1 Like

Thank you, I wasnt expecting that.You must be pretty good to be able to learn another code . Thanks again.

cTrader is coded in C#, which I’m not very familiar with, but most of the languages are similar enough that I can get by with a little help from the documentation. I saw other people on the cTDN forum looking for the same and trying to figure it out, so it was worth me pursuing. I enjoy a challenge. :smiley:

Nice idea. But if you are still around could you please ad an input for pair prefix & suffix. My broker uses a suffix in pair names & this indi is given me an error msg and will not load.

PS - An X & Y axis inputs would be nice also for positioning it on the chart

Thanks
G