If the message has already been executed, it has already been deleted from the queue.
Ok, I have the following question.
#property indicator_chart_windowbool First = true;
int start(){
if(First){
int indexFirstLeftOnChart = WindowFirstVisibleBar();//иницилизируем под флагом, потому что в init() могут быть артефактыAlert("indexFirstLeftOnChart ", indexFirstLeftOnChart);
First = false;
}
if(WindowFirstVisibleBar() != indexFirstLeftOnChart){//проверяем на каждом тике, изменилось ли значениеAlert("first indexFirstLeftOnChart ", indexFirstLeftOnChart);
indexFirstLeftOnChart = WindowFirstVisibleBar();//если изменилось, записываем егоAlert("second indexFirstLeftOnChart ", indexFirstLeftOnChart);
}
return(0);
}
- It beeps on every tick, because it turns out that first indexFirstLeftOnChart is zero. How do I fight this? Build 509.
I have something on a simple point, a headache. There is a function to search for orders.
t - counter of all orders.
p - counter of pending orders.
//+-------------------------------------------------------------------------------------+//| Поиск своих ордеров |//+-------------------------------------------------------------------------------------+void FindOrders(int& t, int& p)
{
int total = OrdersTotal() - 1;
t = 0;
p = 0;
for (int i=total; i>=0; i--)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
if (OrderSymbol() != Symbol()) continue;
if (OrderMagicNumber() != i_magic) continue;
if (OrderType() > 1)
{
p++;
}
t++;
pr ("FindOrders(): " + "t = " + t + " " + TimeToStr(TimeCurrent()));
pr ("FindOrders(): " + "p = " + p + " " + TimeToStr(TimeCurrent()));
}
}
I call it from the start:
int start()
{
if (g_lastBarTime == Time[0]) // На текущем баре все необходимые действия..return (0); // ..уже были выполненыint oTotal = 0, oPending = 0;
FindOrders(oTotal, oPending);
int signal = GetGeneralSignal(oTotal);
if (signal != SIGNAL_NO)
{
if (!Trade(signal))
return(0);
}
else
In fact, when we open it, even when there are no orders, we see this (even when there are no orders, it prints as if there are...):
Good evening everyone. I have decided to master MQL4 recently (I've been studying the tutorial by Sergey Kovalev). I decided to make a simple order opening script today for practice. The code is: int start() { OrderSend("EURUSD",OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point); Alert(GetLastError());
return;
}
The script didn't work and error 4109 (Trading not allowed) was shown. When trying to change the situation, error 4016 (Uninitialised array) also appeared. I would like to know what causes these errors and how to create a simple trade opening script after all. I just copied the example from tutorial https://book.mql4.com/ru/trading/ordersend (I just added function GetLastError into it) and got error 4109 anyway.
intstart()// Спец. функция start(){// Открытие BUYOrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point);
Alert(GetLastError());
return; // Выход из start()}
Кто может объяснить в чем проблема, буду очень признателен. Заранее спасибо.
tell me how to treat such fences in meta-quotes quotes)?
We need to intercept messages.
If the message has already been executed, it has already been deleted from the queue.
Ok, I have the following question.
- It beeps on every tick, because it turns out that first indexFirstLeftOnChart is zero. How do I fight this? Build 509.
If a message has already been executed, it has already been deleted from the queue.
I have something on a simple point, a headache. There is a function to search for orders.
t - counter of all orders.
p - counter of pending orders.
I call it from the start:
In fact, when we open it, even when there are no orders, we see this (even when there are no orders, it prints as if there are...):
How is this possible?
int start()
{
OrderSend("EURUSD",OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point);
Alert(GetLastError());
return;
}
The script didn't work and error 4109 (Trading not allowed) was shown. When trying to change the situation, error 4016 (Uninitialised array) also appeared. I would like to know what causes these errors and how to create a simple trade opening script after all. I just copied the example from tutorial https://book.mql4.com/ru/trading/ordersend (I just added function GetLastError into it) and got error 4109 anyway.
Can you tell me if there is any way to set default comments on the order???
What kind of "order"? What is it for? Where and why does it need a comment?