Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1221

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
The objective is to open only one order on the current zero bar.
If there was already a closed order on the current bar, do not open a new one.
And the code does not work:
but can it be done this way? (Only the last type - with a rectangle - would work now).
is to remove all objects that have the type OBJ_LABEL or OBJ_RECTANGLE_LABEL
The objective is to open only one order on the current zero bar.
If there was already a closed order on the current bar, do not open a new one.
The code does not work:
datetime openBarTime=iTime(_Symbol,_Period,0);
bool orderFound=false;
for(int pos=OrdersTotal()-1;pos>=0;pos--) {
... /// тут всякие проверки на select,magic,symbol,type и проч
if (OrderOpenTime()>=openBarTime) {
orderFound=true; // нашёлся ордер открытый на текущем баре
break;
}
}
if (!orderFound) {
// не было ордеров на текущем баре - трам пам пам
...
}
the orders will have to be memorised and executed separately. In general, it is done better as a complex
About closed orders similar check by HISTORY
What is the usual way to display text on a graphic? Anywhere, just text?
is ithttps://www.mql5.com/ru/docs/objects ? point me in the right direction
what is the usual way to display text on a graphic? anyplace, just text
is ithttps://www.mql5.com/ru/docs/objects ? point me in the right direction
https://www.mql5.com/ru/docs/constants/objectconstants/enum_object/obj_text
https://www.mql5.com/ru/docs/constants/objectconstants/enum_object/obj_label
https://www.mql5.com/ru/docs/constants/objectconstants/enum_object/obj_text
https://www.mql5.com/ru/docs/constants/objectconstants/enum_object/obj_label
Thanks, I'll give it a try.
datetime openBarTime=iTime(_Symbol,_Period,0);
bool orderFound=false;
for(int pos=OrdersTotal()-1;pos>=0;pos--) {
... /// тут всякие проверки на select,magic,symbol,type и проч
if (OrderOpenTime()>=openBarTime) {
orderFound=true; // нашёлся ордер открытый на текущем баре
break;
}
}
if (!orderFound) {
// не было ордеров на текущем баре - трам пам пам
...
}
The pauses will have to be memorised and processed separately. In general, this is done more optimally as a complex
about closed ones, similar check by HISTORY
So, I found an example for my own case from the reference book:
I will close orders like this:
Thanks for your help :)
Balance of power. Where can I download it? Thank you. (chuckles)
Hello. Hello all. Help me find an indicator
Balance of power. Where can I download it? Thank you.
A search on the website will come up with a result.
is to remove all objects which have type OBJ_LABEL or OBJ_RECTANGLE_LABEL
I understand that you can call them 2.
, but my question is this
ObjectsDeleteAll
does the function go through the loop specifying OBJ_TREND and select only objects of the correct object type or does it create the loop with only the required objects at once?