Before any solution code, pls help me understand the basic math. I'm back testing on a $1000 CAD Account trading EURUSD. My broker is AvaTrade and for CAD account trading EURUSD, they list 4.5% as margin:
https://www.avatrade.ca/trading-info/financial-instruments-index/forex
I want to trade 0.06 lots. So it is 0.06*100,000 = 6,000 units, which should cost around 7,320 USD (6,000 * 1.22 EURUSD). Converted to CAD around 1.3 USDCAD, around 9,516 CAD. Then 4.5% of that is 428 CAD.
This is the error:
2023.07.07 19:31:02.047 2021.01.04 07:10:00 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 1000.00, Margin: 1681.28, FreeMargin: -681.28
2023.07.07 19:31:02.047 2021.01.04 07:10:00 CTrade::OrderSend: market buy 0.06 EURUSD sl: 1.22484 tp: 1.22780 [not enough money]
Having a hard time understanding where these numbers come from above ? Margin: 1681.28, FreeMargin: -681.28
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Before any solution code, pls help me understand the basic math. I'm back testing on a $1000 CAD Account trading EURUSD. My broker is AvaTrade and for CAD account trading EURUSD, they list 4.5% as margin:
https://www.avatrade.ca/trading-info/financial-instruments-index/forex
I want to trade 0.06 lots. So it is 0.06*100,000 = 6,000 units, which should cost around 7,320 USD (6,000 * 1.22 EURUSD). Converted to CAD around 1.3 USDCAD, around 9,516 CAD. Then 4.5% of that is 428 CAD.
This is the error:
2023.07.07 19:31:02.047 2021.01.04 07:10:00 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 1000.00, Margin: 1681.28, FreeMargin: -681.28
2023.07.07 19:31:02.047 2021.01.04 07:10:00 CTrade::OrderSend: market buy 0.06 EURUSD sl: 1.22484 tp: 1.22780 [not enough money]
Having a hard time understanding where these numbers come from above ? Margin: 1681.28, FreeMargin: -681.28