Anyboy any idea?
int total=OrdersTotal();; int hstTotal=OrdersHistoryTotal();
These variables aren't being updated. Assign them in your function.for(i=0;i<=total-1; i++){ OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
Check your return codes for errors and report them.
What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hi!
I am trying to create an Expert Advisor which will send every day an e-mail at a specified time to my e-mail adress. I writed the code and it works quiet good (It send the mail with the information about the account), the only problem is that sometimes it sends the information about the opened position multiple times. An example is below: As you see the information came multiple time about the same position. The main goal would be that 1 position would be only once in the list. I quess the problem is in the for cycle, but I am not sure. Could somebody help me where is the problem in the code? (Attached below, too)
Thanks in advance,
Roland
"
Account information (71197844):
2017.11.03 20:00
Account Currency: EUR
Equity: 5003.43
Balance: 4985.50
Margin: 10.00
Free Margin: 4993.43
Profit: 17.93
Open Positions:
1: EURUSD Open Time: 2017.10.20 12:00 Order Type: Sell Lots: 0.01 Open Price: 1.1816 Price: 1.1620 Stop Loss: 1.1976 Take Profit: 1.1446 Swap: 0.00
Profit: 16.83
1: EURUSD Open Time: 2017.10.20 12:00 Order Type: Sell Lots: 0.01 Open Price: 1.1816 Price: 1.1642 Stop Loss: 1.1976 Take Profit: 1.1446 Swap: 0.00
Profit: 14.92
1: EURUSD Open Time: 2017.10.20 12:00 Order Type: Sell Lots: 0.01 Open Price: 1.1816 Price: 1.1659 Stop Loss: 1.1976 Take Profit: 1.1446 Swap: 0.00
Profit: 13.45
1: EURUSD Open Time: 2017.10.20 12:00 Order Type: Sell Lots: 0.01 Open Price: 1.1816 Price: 1.1646 Stop Loss: 1.1976 Take Profit: 1.1446 Swap: 0.00
Profit: 14.56
1: EURUSD Open Time: 2017.10.20 12:00 Order Type: Sell Lots: 0.01 Open Price: 1.1816 Price: 1.1607 Stop Loss: 1.1976 Take Profit: 1.1446 Swap: 0.00
Profit: 17.93
Closed Positions:
1: AUDJPY Open Time: 2017.10.26 22:00 Order Type: Sell Lots: 0.01 Open Price: 87.3470 Close Time: 2017.11.01 Close Price: 87.5980 Swap: 0.00
Profit: -1.89
1: Open Time: 2017.11.01 08:41 Order Type: Lots: 0.01 Open Price: 0.0000 Close Time: 2017.11.01 Close Price: 0.0000 Swap: 0.00
Profit: -0.06
Best Regards,
R&R Forex
"