kissmez: The OrderSelect before this line return true and I tested the
orderticket on that is right. As you can see In begin, i have used
OrderCloseTime and it works, but i don't know how i use it again then it
doesn't work although the Order is closed.
- How do you know that, you didn't bother to check your return codes What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- How do you know that the order is closed? You just tried to modify it.
OrderModify(IDS_Tien[a[i]][0],0,0,GiaS[a[i]][0],0); int check=GetLastError(); if (check==4108 || check==1) break; } : OrderSelect(IDS_Tien[a[i]][0],SELECT_BY_TICKET); Tgiandong=OrderCloseTime();
Check your return codes. - You would never write if( (2+2 == 4) == true) would you? if(2+2 == 4) is sufficient. So Don't write if(bool == true), just use if(bool) or if(!bool).
- Code becomes self
documenting when you use meaningful variable names, like bool isLongEnabled.
Long_Entry sounds like a trigger price or a ticket number and "if long entry" is
an incomplete sentence. a[i] is meaningless
- Don't double post
whroeder1:
- How do you know that, you didn't bother to check your return codes What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- How do you know that the order is closed? You just tried to modify it.Check your return codes.
- You would never write if( (2+2 == 4) == true) would you? if(2+2 == 4) is sufficient. So Don't write if(bool == true), just use if(bool) or if(!bool).
- Code becomes self
documenting when you use meaningful variable names, like bool isLongEnabled.
Long_Entry sounds like a trigger price or a ticket number and "if long entry" is
an incomplete sentence. a[i] is meaningless
- Don't double post
Thanks for your reply;
1. I use Comment() Comand to check what its return.
2. As you can see i put the script in loop for, so that when the order is closed the OrderCloseTime will return value and i check it by compare with 0.
3. Thanks for your suggest ^^
4. I don't understand what you mean. Can you explain more?
5. Sorry for that ^^
kissmez: 4. I don't understand what you mean. Can you explain more?
| What part of "use meaningful variable names ... a[i] is meaningless" is unclear? |
![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
Hello everyone,
I'm thinking and tested for hours but i can't figure out this error
I have this scrips:
I'm tested that the problems at this line
The OrderSelect before this line return true and I tested the orderticket on that is right. As you can see In begin, i have used OrderCloseTime and it works, but i don't know how i use it again then it doesn't work although the Order is closed.
I'm very happy if you can help me. Thank you so much