[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 588

 
link1:

the date is the same, from 15th february to 16th february


or any other date. the conditions are all the same, but each time the result is different

 

How do I know if a pending order is triggered or not?

Or in general - two pending orders in different directions, as soon as one has triggered, we close the second one... I'm dull - help me.

 
link1:


or any other date. the conditions are all the same, but each time the result is different

the spread is taken from the market at the moment and is considered to be the same throughout the testing period
 
ilunga:
the spread is taken from the market at the moment and is considered the same throughout the testing period


Ahh... that's it, i got it now, thank you very much! )

There is also a modelling quality item in the report, it is always 25%. is there any way to improve it?

 
link1:


ahhh... that's it, got it now, thank you very much! )

There is also a modelling quality item in the report, it is always 25%. is there any way to improve it?

read some articles on modelling

like https://www.mql5.com/ru/articles/1513

 
ilunga:

Read some articles on modelling

e.g. https://www.mql5.com/ru/articles/1513


oh, thanks again, just what i needed, thanks )
 

How do I know if a pending order has been triggered and compare its ticket?

 
DOCTORS:

How do I know if a pending order has been triggered and compare its ticket?

Select an order with OrderSelect and see its OrderType
 

//+------------------------------------------------------------------+
//| Stas_helper_v01.mq4 |
//| DOC |
//| DR_GAD@mail.ru |
//+------------------------------------------------------------------+
#property copyright "DOC"
#property link "DR_GAD@mail.ru"

//--- input parameters
extern double Stop=15;
extern double Profit=35;
extern double Lots=1;

extern int k=1;
extern int x;
extern int y;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
int i;
//----
ObjectsDeleteAll();

for(i=OrdersTotal()-1; i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS))
{
if (OrderType() == OP_BUYSTOP)
{
OrderDelete(OrderTicket());
}
if (OrderType() == OP_SELLSTOP)
{
OrderDelete(OrderTicket());
}
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
int ticket1,ticket2, total,i;
double price;
string Symb;
//1.выставление отложенных ордеров
Symb=Symbol();

if(k==1)
{
price=NormalizeDouble((Ask-Bid)/2,Digits);

ticket1=OrderSend(Symb,OP_BUYSTOP,Lots,Bid+((Stop*Point))+price,3,Bid+(Ask-Bid)/2,Bid+((Stop*Point))+price+Profit*Point, "Отложенник",1,0,Green);
if(ticket1<0)
{
Print("Ошибка!#",GetLastError());
return(0);
}
ticket2=OrderSend(Symb,OP_SELLSTOP,Lots,Bid-((Stop*Point))+price,3,Ask-(Ask-Bid)/2,Bid-((Stop*Point))+price-Profit*Point, "Отложенник2",2,0,Green);
if(ticket2<0)
{
Print("Ошибка!#",GetLastError());
return(0);
}
k=2;
}
//1.-----------------------------

//2. Если ордер открылся.

if (k==2)

{
OrderSelect(ticket1,SELECT_BY_TICKET,MODE_TRADES);
if (OrderType()==OP_BUY)
{
OrderDelete(ticket2);
k=3;

}
OrderSelect(ticket2,SELECT_BY_TICKET,MODE_TRADES);
if (OrderType()==OP_SELL)
{
OrderDelete(ticket1);
k=3;

}



}


//2----------------------
return(0);
}
//+------------------------------------------------------------------+

Why doesn't the other pending order close?

 
DOCTORS:


//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{

int ticket1,ticket2, total,i;

Why isn't the other pending order closed?

Because these are local variables that already on the second tick store rubbish instead of ticket
Reason: