Функции, задающие свойства графических объектов, а также операции создания ObjectCreate() и перемещения ObjectMove() объектов на графике фактически служат для отправки команд графику. При успешном выполнении этих функций команда попадает в общую очередь событий графика. Визуальное изменение свойств графических объектов производится в процессе...
... /// тут всякие проверки на 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:
bool orderFound=false;
// retrieving info from trade history int i,accTotal=OrdersHistoryTotal();
for(i=0;i<accTotal;i++)
{
//---- check selection result if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false)
{
Print("Ошибка при доступе к исторической базе (",GetLastError(),")"); break;
}
// работа с ордером ... if (OrderCloseTime() > iTime(_Symbol,_Period,0))orderFound=true ;// нашёлся ордер закрытый на текущем баре
}
//-----if(OrdersTotal() < 1 && orderFound == false ) {//тут открываем ордера по алгоритму
I will close orders like this:
if( OrdersTotal() > 0)
{
for(cnt = 0; cnt < OrdersTotal(); cnt++)
{
bool s = OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if( TimeCurrent()>= OrderOpenTime()+ (lifetime * 60)) // lifetime - время в минутах
{
if(OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber()) // long position is opened
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?
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
ObjectsDeleteAlldoes 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?