
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Just as a test—do you have the AUDUSD symbol active on your Market Watch, and if not, can you please enable it, and try again?
I did not. I've added this symbol (both live and demo variants for my broker, AUDUSD and AUDUSD.a) to my Market Watch.
I will report back tomorrow as my EA only places orders once per day. I have only encountered this issue in live conditions and cannot replicate it in the tester.
Just as a test—do you have the AUDUSD symbol active on your Market Watch, and if not, can you please enable it, and try again?
@Fernando Carreiro, what are you thinking? Looks like this had an effect.
I have the EA running in two terminals, trading the same symbols (DE40, GBPJPY, GBPUSD, USDJPY).
I was reading through this material: https://www.mql5.com/en/book/automation/experts/experts_ordercalcprofit
Which made me realise the terminal needs to exchange the order profit currency to my account currency to calculate the theoretical profit value. So I added EURAUD and AUDJPY to the Market Watch for the second terminal. This didn't help and all calculations failed.
It was only once AUDUSD was added (to the first terminal) that OrderCalcProfit() seems well-behaved.
@Fernando Carreiro, what are you thinking? Looks like this had an effect.
I have the EA running in two terminals, trading the same symbols (DE40, GBPJPY, GBPUSD, USDJPY).
I was reading through this material: https://www.mql5.com/en/book/automation/experts/experts_ordercalcprofit
Which made me realise the terminal needs to exchange the order profit currency to my account currency to calculate the theoretical profit value. So I added EURAUD and AUDJPY to the Market Watch for the second terminal. This didn't help and all calculations failed.
It was only once AUDUSD was added (to the first terminal) that OrderCalcProfit() seems well-behaved.
It's probably an issue due to the suffix as the needed symbols (like AUDUSD) are supposed to be added (but hidden) automatically.
Could you send me a private message with the broker you are using ? I would check it.
So I run a small test, on your broker, live account in AUD. I tried with several symbols (GBPJPY.a,...) and got each time the same behaviour.
1. I closed all charts. I "Hide all" in Market Watch.
2. I add one symbol. Then open a chart on this symbol.
3. I ran my script.
(DE40.a,H1) account currency is AUD
(DE40.a,H1) DE40.a: BUY PROFIT: via OrderCalcProfit = 0.00 AUD (1000 ticks) with 0.10 lot.
(DE40.a,H1) Symbol "DE40.a" selected in Market Watch and Visible .
(DE40.a,H1) Symbol "EURAUD" selected in Market Watch and NOT Visible.
(DE40.a,H1) Symbol "EURUSD" selected in Market Watch and NOT Visible.
(DE40.a,H1) account currency is AUD
(DE40.a,H1) DE40.a: BUY PROFIT: via OrderCalcProfit = 1.63 AUD (1000 ticks) with 0.10 lot.
(DE40.a,H1) Symbol "DE40.a" selected in Market Watch and Visible .
(DE40.a,H1) Symbol "EURAUD" selected in Market Watch and NOT Visible.
(DE40.a,H1) Symbol "EURUSD" selected in Market Watch and NOT Visible.
The first time I got 0, which is 'normal' and can always happen if the underlying data feed are not ready. Then I got correct values each time. I didn't add any additional symbol myself, only the tested symbol.
So I can't reproduce your issue, as you said you always got 0.0 returned by OrderCalcProfit() (except adding some symbol manually).
So I run a small test, on your broker, live account in AUD. I tried with several symbols (GBPJPY.a,...) and got each time the same behaviour.
1. I closed all charts. I "Hide all" in Market Watch.
2. I add one symbol. Then open a chart on this symbol.
3. I ran my script.
(DE40.a,H1) account currency is AUD
(DE40.a,H1) DE40.a: BUY PROFIT: via OrderCalcProfit = 0.00 AUD (1000 ticks) with 0.10 lot.
(DE40.a,H1) Symbol "DE40.a" selected in Market Watch and Visible .
(DE40.a,H1) Symbol "EURAUD" selected in Market Watch and NOT Visible.
(DE40.a,H1) Symbol "EURUSD" selected in Market Watch and NOT Visible.
(DE40.a,H1) account currency is AUD
(DE40.a,H1) DE40.a: BUY PROFIT: via OrderCalcProfit = 1.63 AUD (1000 ticks) with 0.10 lot.
(DE40.a,H1) Symbol "DE40.a" selected in Market Watch and Visible .
(DE40.a,H1) Symbol "EURAUD" selected in Market Watch and NOT Visible.
(DE40.a,H1) Symbol "EURUSD" selected in Market Watch and NOT Visible.
The first time I got 0, which is 'normal' and can always happen if the underlying data feed are not ready. Then I got correct values each time. I didn't add any additional symbol myself, only the tested symbol.
So I can't reproduce your issue, as you said you always got 0.0 returned by OrderCalcProfit() (except adding some symbol manually).
Thanks for looking @Alain Verleyen.
When you say it is "normal" to get profit of 0 the first time OrderCalcProfit() is called, perhaps because our terminal is missing data, what is the most appropriate handling of this?
Thanks for looking @Alain Verleyen.
When you say it is "normal" to get profit of 0 the first time OrderCalcProfit() is called, perhaps because our terminal is missing data, what is the most appropriate handling of this?
I am just waiting next tick.
You can explore other methods if you need it.