There are complex logics that work for twenty-four hours, but at one point they freeze. This sometimes happens in EX5, the source code of which cannot be edited. Is it possible to determine from the outside that an indicator or an Expert Advisor hangs? Collect statistics on the calculated part of a particular indicator?
With indicators, it seems possible, because they are in a hung state they kill the update of charts on their symbol. The Expert Advisor can trace it, albeit without specifying which indicator caused the hover.
Setting records for bans. During bans I get replies on the forum, but I can only read them. And after another ban is lifted it's very hard to remember who and where answered in order to continue. Is it possible to solve this issue (without advice not to get banned anymore)? And in general sometimes you read, but do not have time to respond right away. Is it possible to set a reminder flag to "reply later"?
comp: Setting records for bans. During bans I get replies on the forum, but I can only read them. And after another ban is lifted it's very hard to remember who and where answered in order to continue. Is it possible to solve this issue (without advice not to get banned anymore)? And in general sometimes you read, but do not have time to respond right away. Is it possible to set a reminder flag to "reply later"?
First you have to think, and then do. Not the other way round. Then there will be no problems with memory.
comp: Is it possible to put a reminder flag to yourself to "reply later"?
I partly understand you. Everyone wants a solution to their immediate problems. In your case, it's too much. You, even sitting in a bathhouse, are trying to build developers up.
Can you kind people explain why this is the case? If it should be like this, please add in the documentation that only first digit after full stop is taken into account.
Colleagues, please help. I don't have enough brains of my own.
The robot, which has placed Limit orders, needs to delete the remaining order when closing an open position (no matter if at stop or profit), but not every order, but the one whose magic number is equal to the ticket of the closed position. So, the trigger for deletion must be the position closing event. For me it does not matter in this case, how this position has closed (just by condition it will turn out that if closing by SL, then there are no limits, which must be removed). But if we detail and do it right, the trigger is a TP.
So, the robot deletes the order, but not after the position has been closed, but as soon as it was opened. And it starts to fight itself by constantly placing anddeleting the pending orders. Please see what's wrong.
inputdouble lot = 0.2;
inputdouble TakeProfitPips = 50;
inputdouble StopLossPips = 200;
int bar=0;
int shift=1;
int tiket;
int otkt;
double price;
int cnt;
double TPp,SLp;
int tkt;
int n;
int type;
int _OrdersTotal = 0;
// кол-во позиций, соответствующих критериям (текущий инструмент и заданный MagicNumber),// состоянием на текущий тикint now_OrdersTotal = 0;
// кол-во позиций, соответствующих критериям (текущий инструмент и заданный MagicNumber),// состоянием на предыдущий тикstaticint pre_OrdersTotal = 0;
// массив открытых позиций состоянием на текущий тикint now_OrdersArray[][2]; // [№ в списке][№ тикета, тип позиции]// текущий номер позиции в массиве now_OrdersArray (для перебора)int now_CurOrder = 0;
// текущий номер позиции в массиве pre_OrdersArray (для перебора)int pre_CurOrder = 0;
// массив для хранения количества закрытых позиций каждого типаint now_ClosedOrdersArray[6][3]; // [тип ордера][тип закрытия] // временные флагиbool OrderClosed = true, PendingOrderOpened = false;
// временные переменныеint pre_OrdersArray[][2]; // [количество позиций][№ тикета, тип позиции]//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
//---//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//---
}
voidOnTick()
{
if(OrdersTotal()== 0 && iTime(Symbol(),PERIOD_M1,1)==D'14.01.16 16:30')
{
price=Open[shift];
tiket=OrderSend(Symbol(),OP_SELLLIMIT,lot,price,3,price+StopLossPips*Point,price-TakeProfitPips*Point);
if(tiket<0)
{
Print("Ошибка OrderSend № - ",GetLastError());
}
}
if(OrdersTotal()!=0)
{
for(cnt=0; cnt<OrdersTotal(); cnt++)
OrderSelect(cnt,SELECT_BY_POS); // Если есть следующий
{ // Анализ ордеров:
price=OrderOpenPrice();
otkt = OrderTicket();
n=otkt;
//--------------------------------------------------------------if(OrderType()==OP_SELL && OrderMagicNumber()==0)
{
tiket=OrderSend(Symbol(),OP_SELLLIMIT,lot*3,price+100*Point,1,price+StopLossPips*Point,price-TakeProfitPips*Point,"My order",n);
tiket=OrderSend(Symbol(),OP_SELLLIMIT,lot*9,price+200*Point,1,price+StopLossPips*Point,price-TakeProfitPips*Point,"My order",n);
}
}
}
_OrdersTotal = OrdersTotal(); // запоминаем общее количество позицийArrayResize( now_OrdersArray, _OrdersTotal ); // изменяем размер массива открытых позиций под текущее кол-воArrayInitialize( now_OrdersArray, 0.0 ); // обнуляем массив
now_OrdersTotal = 0; // обнуляем количество позиций, соответствующих критериямArrayInitialize( now_ClosedOrdersArray, 0.0 ); // обнуляем массивы закрытых позиций и сработавших ордеров//+------------------------------------------------------------------+//| Перебираем все позиции и записываем в массив //+------------------------------------------------------------------+for ( int z = _OrdersTotal - 1; z >= 0; z -- )
{
if ( OrderSelect( z, SELECT_BY_POS ) )
{
now_OrdersArray[now_OrdersTotal][0] = OrderTicket();
now_OrdersArray[now_OrdersTotal][1] = OrderType();
now_OrdersTotal ++;
}
}
ArrayResize( now_OrdersArray, now_OrdersTotal ); // изменяем размер массива открытых позиций под кол-во позиций, соответствующих критериям//+------------------------------------------------------------------+//| Перебираем список позиций предыдущего тика, и считаем сколько закрылось позиций и//| сработало отложенных ордеров//+------------------------------------------------------------------+for ( pre_CurOrder = 0; pre_CurOrder < pre_OrdersTotal; pre_CurOrder ++ )
{
tkt = pre_OrdersArray[pre_CurOrder][0]; // запоминаем тикет и тип ордера
type = pre_OrdersArray[pre_CurOrder][1];
OrderClosed = true; // предпологаем, что если это позиция, то она закрыласьfor ( now_CurOrder = 0; now_CurOrder < now_OrdersTotal; now_CurOrder ++ ) // перебираем все позиции из текущего списка открытых позиций
{
if ( tkt == now_OrdersArray[now_CurOrder][0] ) // если позиция с таким тикетом есть в списке,
{ OrderClosed = false; // значит позиция не была закрыта (ордер не был удалён)break;
}
}
if ( OrderClosed ) // если была закрыта позиция (удалён ордер),
{
if (OrderSelect( tkt, SELECT_BY_TICKET )) // выбиаем ее
n = tkt; // присваеваем n номер тикета
}
}
//+------------------------------------------------------------------+//| Удаляем ордер с магическим номером = тикету закрытой ранее позиции //+------------------------------------------------------------------+for ( int z = _OrdersTotal - 1; z >= 0; z -- )
{
if ( OrderSelect( z, SELECT_BY_POS ) )
otkt = OrderTicket();
if (n == OrderMagicNumber ())
{OrderDelete( otkt );}
}
return;
}
Can you tell me if there is a built-in mechanism to determine which market the trading robot is running in, you need to identify the FOREX and FORTS markets.
Help, guys, can not put the Russian language on MT4 on Macbook, it seems to be present, but it is displayed in hieroglyphs, but in the meta editor is fine. I built it all through Play on mac,
There are complex logics that work for twenty-four hours, but at one point they freeze. This sometimes happens in EX5, the source code of which cannot be edited. Is it possible to determine from the outside that an indicator or an Expert Advisor hangs? Collect statistics on the calculated part of a particular indicator?
With indicators, it seems possible, because they are in a hung state they kill the update of charts on their symbol. The Expert Advisor can trace it, albeit without specifying which indicator caused the hover.
Setting records for bans. During bans I get replies on the forum, but I can only read them. And after another ban is lifted it's very hard to remember who and where answered in order to continue. Is it possible to solve this issue (without advice not to get banned anymore)? And in general sometimes you read, but do not have time to respond right away. Is it possible to set a reminder flag to "reply later"?
You should think first and then do. Not the other way round. Then there will be no problems with memory.
Golden words !!!
Sometimes you read it and don't have time to reply right away. Is it possible to put some sort of reminder flag to yourself to "reply later"?
Is it possible to put a reminder flag to yourself to "reply later"?
Question about MathRound() in MQL4, which "returns a value rounded to the nearest integer of a specified numeric value".
Code:
Result:
Can you kind people explain why this is the case? If it should be like this, please add in the documentation that only first digit after full stop is taken into account.
Colleagues, please help. I don't have enough brains of my own.
The robot, which has placed Limit orders, needs to delete the remaining order when closing an open position (no matter if at stop or profit), but not every order, but the one whose magic number is equal to the ticket of the closed position. So, the trigger for deletion must be the position closing event. For me it does not matter in this case, how this position has closed (just by condition it will turn out that if closing by SL, then there are no limits, which must be removed). But if we detail and do it right, the trigger is a TP.
So, the robot deletes the order, but not after the position has been closed, but as soon as it was opened. And it starts to fight itself by constantly placing anddeleting the pending orders. Please see what's wrong.
Help, guys, can not put the Russian language on MT4 on Macbook, it seems to be present, but it is displayed in hieroglyphs, but in the meta editor is fine. I built it all through Play on mac,
Wine 1.9.4 would be much appreciated.