Alberto Tortella:
You're welcome
Thank you!
Biantoro Kunarto: You should write this code inside start() function :
Start using the new Event Handling Functions.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
Ok now my monitor works better.
I wrote the following code to delete the objects related to the closed orders, but it does not work well. Could you help me? Thank you!
void DeleteLabels() { int obj_total=ObjectsTotal(); for(int ww=obj_total-1;ww>(OrdersTotal()+1)*9;ww--) { string name=ObjectName(ww); ObjectDelete(name); } }
In the first rows I see the market ticket and it's ok.
Then I see the closed orders, but I don't want to see them.
Files:
Prova_3_r1g.mq4
11 kb
int total = OrdersTotal(); for(int cnt=0;cnt<=total;cnt++){ OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES) ; int a = 1 + cnt ; ObjectCreate("a", OBJ_LABEL, 0, 0, 0, 0);
- If there are total orders, their positions are zero to total orders minus one. Your last select always fails but since you don't check everything after that is BOGUS.
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 - You are creating object using position as a name. As older orders get closed, position indexes change. You can't create new objects with the same old names. Don't use non-unique names (position,) use ticket.
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 all, could you indicate the mistakes in this indicator monitor?
I'm trying to write this indicator to monitor the global variables in my expert, but I don't find the errors...
Thank you!