[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 439

 
peshihod:


I understand that a pending order and an open order are different orders. And if the pending order is opened, then the task is reduced to the initial one, to the open order. If I understand it correctly, it is getting very complicated.

What are the tasks? Perhaps, everything can be done in a simpler way?

I understand that a pending and an open order are different orders. -------------- Yes (maybe) Maybe not. The main thing is that the script should trigger at opening of this pending order, i.e. not when it is placed but when it is opened.

I need help in writing the script, please help me, Professionals, experts and good people, suggest changes if you want it to work.


If i have a pending order, its price reaches it and robot should react too. I want it to work on such orders too.

Well, I am testing it now and it works. Why it didn't work in the 1st test hmmm... Maybe because of computer restart ...But after planned restart, robot smiled (worked).

One more detail . This script will not work on historical charts, and why?

//+------------------------------------------------------------------+
//| Order_act.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
int Order_array[200];
int Total=0;
int j,pos,count,order_tick,type;
bool found;

//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
// создаем список ордеров (туда входят и открытые, и отложенные)
Total=OrdersTotal();

for(pos=0;pos<Total;pos++)
{
if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)==true)
{ Order_array[pos]=OrderTicket();}
}

// проверочная часть скрипта
int i=0;
while ( !IsStopped() )
{
count=OrdersTotal();
for(pos=0;pos<count;pos++)
{
if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)==true)
{
found=false;
order_tick=OrderTicket();

for (j=0;j<Total;j++)
{

if (order_tick==Order_array[j]) {found=true;}
}
if (!found)
{
type=OrderType();

if ((type==OP_BUY) || (type==OP_SELL))
{
Total++; // в случае,если есть новый открытый
Order_array[Total-1]=order_tick; //ордер - добавляем в список

Alert("Новый открытый ордер"); // и делаем с ним что хотим

}
}
}
// если планируется, что скрипт будет работать долго или открываемся часто
// удаляем из списка все закрытые ордера чтобы не было переполнения.
// А чтобы работало быстрее, количество записей можно уменьшить (лишь бы не превысило
// максимально возможного числа открытых и отложенных поз.
if (Total>190)
{
for (j=0;j<Total;j++)
{
if(OrderSelect(Order_array[j],SELECT_BY_TICKET)==true)
{
if (OrderCloseTime()!=0)
{
Alert("нашли закрытый в списке и удалили");
for (i=j+1;i<Total;i++) {Order_array[j]=Order_array[i];}
Total--;
}
}
}
}
Sleep(100);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+

Его написал RAVen_ Спасибо этому профессионалу .

 

Dear Professionals,

How can I teach an EA to read information from another window where another EA is working on the same currency pair?

 
demlin:

Dear Professionals,

How can I teach an EA to read information from another window, where another EA is working on the same currency pair?


Try to go another way, namely to exchange values between EAs with global variables... I didn't use them myself, I don't know the details, search for them and see how they are used...
 
demlin:

Dear Professionals,

How can I teach an EA to read information from another window, where another EA is working on the same currency pair?

There is also such a library.
 
semiromid:

I understand that a pending order and an open order are different orders. -------------- Yes (maybe) Maybe not. The main thing is that the script should work when the pending order is opened, i.e. not when it is placed but when it is opened.


This is digging up a couple of trees with an excavator! What is the point of separating the orders? The price is the same for all. Orders are always processed together, in bulk, by the same best variant.

I.e. it does not matter who places the orders, it is important what parameters each individual order has. You are looking for an empty one.

If we have to execute task1 and task2, then we have to check each order, whether the necessary task has been executed for it or not. And there is no need to check whether this order is opened right now, or just before, or is about to open.

 
peshihod:


It's digging up a couple of trees with an excavator! What is the point of separating the orders? The price is the same for all. Orders are always processed together, in bulk, at the same best option.

I.e. it does not matter who places the orders, what matters is the parameters of each individual order. You are looking for an empty one.

If we have to execute task1 and task2, then we have to check each order, whether the necessary task has been executed for it or not. And there is no need to check if this order is opened right now, or just a bit earlier, or is about to open.

It is digging up a couple of trees with an excavator! ----------- What simpler option is there?

What is the point of splitting orders? -------------- I need to split my orders into buoy and sell. Or you mean the processing of orders? At least give me a hint how to make the script simpler ?

Stano, testing it now, everything works. Why didn't it work in the 1st test hmm... Maybe because there was a computer restart ...But after a scheduled restart, the robot was smiling (working). What are the options as to why it didn't work then ? Just maybe a similar malfunction will happen in the future.

 

Good day to all.

I have this question. Suppose there is an indicator XXXXXXX (name does not matter)

Unfortunately, I don't have the source code of the indicator. Therefore, I don't understand what it is based on)

Can I develop an Expert Advisor based on XXXXXXXXX indicator signals for opening Sell and Buy orders?

Here is an example on a screenshot

 
FreeSerfer:

Good day to all.

I have this question. Suppose there is an indicator XXXXXXX (name does not matter)

Unfortunately, I don't have the source code of the indicator. Therefore, I don't understand what it is based on)

Can I develop an Expert Advisor based on XXXXXXXXX indicator signals for opening Sell and Buy orders?

Here is an example on a screenshot


Yeah, maybe. I can even guess what kind of turkey... :-)))
 

Please advise. How can I make this robot buy in 20 seconds?

I don't want it to buy in 20 seconds, then the price is worth another 20 seconds, so it only wins in 40 seconds.

int start()
{

OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point, "Order #", 0); // open a buy order
Sleep(20000); // Timer for 20 seconds

return(0);
}

 
A looped script is needed to work by time, not by ticks.