Errors, bugs, questions - page 818

 
sion:

Does anyone use OnTradeTransaction, to determine if an order has been placed?

In the strategy tester, when one trade and 2 orders are sent within 3 ticks, TRADE_TRANSACTION_REQUEST only comes 1, on the last order sent.

Are you looking at the tester's logs or the agent's logs? Can you write to Service Desk and provide details?
Общайтесь с разработчиками через Сервисдеск!
Общайтесь с разработчиками через Сервисдеск!
  • www.mql5.com
Ваше сообщение сразу станет доступно нашим отделам тестирования, технической поддержки и разработчикам торговой платформы.
 
Rosh:
Are you looking at tester's logs or agent's logs? Can you write to Service Desk and provide details?

I looked at the logs in agent, and there too big a piece of log should be printed. I've just sketched an approximate code, I'm too lazy to deal with Service Desk. I ran it on RoboForex since 2011.10.10 where one of three TRADE_TRANSACTION_REQUEST appears, and on Metakvot two of three. Apparently it depends on how often the ticks appear.

2012.08.22 09:43:15 Terminal SIGTrader 5 x64 build 687 started

Files:
test5.mq5  8 kb
 
sion:

I looked at the logs in agent, and there too big a piece of log should be printed. I've just sketched an approximate code, I'm too lazy to deal with servicedesk. I ran it on RoboForex since 2011.10.10 where one of three TRADE_TRANSACTION_REQUEST appears, and two of three appear on Metakvot. Apparently, it depends on frequency of ticks.

2012.08.22 09:43:15 Terminal SIGTrader 5 x64 build 687 started

In idea,OnTradeTransaction doesn't depend on ticks at all - it is the trade event handler.

And it handles its own turn, the queue of trade events.

 
Urain:

OnTradeTransaction is supposedly not at all tick-dependent, it is a trade event handler.

And it processes its turn, a queue of trade events.

In this example, it depends on the ticks to set orders, on each tick a new order is set.

I wonder if lack of TRADE_TRANSACTION_REQUEST has been repeated by the developers, or we can't do it without Service Desk?

 
sion:

In this example, the speed of order placement depends on the ticks, a new order is placed on every tick.

I wonder if lack of TRADE_TRANSACTION_REQUEST was repeated by developers, or can't do it without Service Desk?

Probably can't do without SD, the function is new and bugs are possible. Need to look into it in detail.

SZY I'm whipping up an article on how to use this function, but I have not encountered such a situation.

ZZZY I only tested it on Alpari and MQ servers,

If you give me the correct server name, I will try to check it.

 
Urain:

Probably not without a CD, the function is new and there may be bugs. I need to look into it in detail.

I am making an article on the use of this function, but this situation has never occurred to me.

ZZZY I checked only on Alpari and MQ servers,

Please give me the correct server name, I will try to check it.

RoboForex-MetaTrader 5

MetaQuotes-Demo

EURUSD is the currency, but it is mentioned in the logs above.

I have attached a file with the date 10.10.10. I have checked it again and it shows only 1 last TRADE_TRANSACTION_REQUES on RoboForex.

 
sion:

RoboForex-MetaTrader 5

MetaQuotes-Demo

EURUSD is the currency, but it is mentioned in the logs above.

The file attached above shows a start on the 10th of the month, hence the beginning of the test was 2011.10.10. I checked it once again, only 1 last TRADE_TRANSACTION_REQUES is consistently received by RoboForex.

The bug is not reproducing.

Both on MQ and RoboForex, in realtime and in the tester all TRADE_TRANSACTION_REQUEST are coming normally.

The system is x86, I can't check on x64 at the moment.

 

By comparing the 2 logs, we can see that if OnTradeTransaction has not been processed before a new order is placed, TRADE_TRANSACTION_REQUEST is dropped.

Here is 1 of 3

GM 0 Trade 03:35:28 2011.10.10 02:00:00 instant sell 1.00 EURUSD at 1.3385 (1.3385 / 1.3387 / 1.3385)
OL 0 Trades 03:35:28 2011.10.10 02:00:00 deal #2 sell 1.00 EURUSD at 1.3385 done (based on order #2)
JQ 0 Trade 03:35:28 2011.10.10 02:00:00 deal performed [#2 sell 1.00 EURUSD at 1.3385]
RJ 0 Trade 03:35:28 2011.10.10 02:00:00 order performed sell 1.00 at 1.3385 [#2 sell 1.00 EURUSD at 1.3385]       <== 1
MH 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 TRADE_ACTION_DEAL Установлен 1 ордер
HE 0 Trade 03:35:28 2011.10.10 02:00:00 buy limit 1.50 EURUSD at 1.3234 (1.3384 / 1.3386 / 1.3384)                    <== 2
MP 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 TRADE_ACTION_PENDING Установлен 2 ордер
QN 0 Trade 03:35:28 2011.10.10 02:00:00 buy limit 1.50 EURUSD at 1.3285 (1.3385 / 1.3387 / 1.3385)                    <== 3
MM 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 TRADE_ACTION_PENDING Установлен 2 ордер
HI 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ///////////////////// trans.type==6----- n=0
GE 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ****************************************************************************
GD 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ///////////////////// trans.type==2----- n=1
CF 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ****************************************************************************
MF 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ///////////////////// trans.type==3----- n=2
OS 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ****************************************************************************
OQ 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ///////////////////// trans.type==0----- n=3
KL 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ****************************************************************************
JL 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ///////////////////// trans.type==0----- n=4
GN 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ****************************************************************************
EO 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ///////////////////// trans.type==0----- n=5
CK 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ****************************************************************************
PI 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ///////////////////// trans.type==0----- n=6
OD 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ****************************************************************************
LG 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ///////////////////// trans.type==10----- n=7
OJ 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 EnumToString(type)=TRADE_TRANSACTION_REQUEST
QN 0 test5 (EURUSD,M30) 03:35:28 2011.10.10 02:00:00 ------------trans===
TRADE_TRANSACTION_REQUEST

here 2 of 3

CL 0 Trade 03:36:07 2011.10.10 02:00:00 instant sell 1.00 EURUSD at 1.33989 (1.33989 / 1.34003 / 1.33989)
NP 0 Trades 03:36:07 2011.10.10 02:00:00 deal #2 sell 1.00 EURUSD at 1.33989 done (based on order #2)
QR 0 Trade 03:36:07 2011.10.10 02:00:00 deal performed [#2 sell 1.00 EURUSD at 1.33989]
DJ 0 Trade 03:36:07 2011.10.10 02:00:00 order performed sell 1.00 at 1.33989 [#2 sell 1.00 EURUSD at 1.33989] <== 1
RK 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 TRADE_ACTION_DEAL 1 order executed
QE 0 Trade 03:36:07 2011.10.10 02:00:00 buy limit 1.50 EURUSD at 1.32490 (1.33990 / 1.34004 / 1.33990) <== 2
LS 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 TRADE_ACTION_PENDING 2nd order set
GP 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ///////////////////// trans.type==6----- n=0
JM 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ****************************************************************************
DM 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ///////////////////// trans.type==2----- n=1
JH 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ****************************************************************************
FJ 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ///////////////////// trans.type==3----- n=2
JG 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ****************************************************************************
DG 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ///////////////////// trans.type==0----- n=3
JR 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ****************************************************************************
ID 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ///////////////////// trans.type==0----- n=4
JQ 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ****************************************************************************
IR 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ///////////////////// trans.type==10----- n=5
RP 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 EnumToString(type)=TRADE_TRANSACTION_REQUEST
RG 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ------------trans===
TRADE_TRANSACTION_REQUEST
...
FD 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:00 ****************************************************************************
OG 0 trade 03:36:07 2011.10.10 02:00:01 buy limit 1.50 EURUSD at 1.32992 (1.33992 / 1.34006 / 1.33992) <== 3
QQ 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:01 TRADE_ACTION_PENDING 2nd order set
RQ 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:01 ///////////////////// trans.type==0----- n=6
OO 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:01 ****************************************************************************
RM 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:01 ///////////////////// trans.type==10----- n=7
CF 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:01 EnumToString(type)=TRADE_TRANSACTION_REQUEST
CJ 0 test5 (EURUSD,H1) 03:36:07 2011.10.10 02:00:01 ------------trans===
TRADE_TRANSACTION_REQUEST

...

 
Urain:

The bug is not working.

Both on MQ and RoboForex, in realtime and in the tester all TRADE_TRANSACTION_REQUEST come normally.

The system is x86, I can't check it on x64 at the moment.

Tried it on an old laptop, it worked sequentially: setting orders - response - setting orders - response - setting orders - response

I think it should work if we send 2 orders during 1 tick.OnTradeTransaction will not work in time then.

I tweaked the file a bit.

Files:
test5.mq5  8 kb
 

Good afternoon.

I have created a unit to count beats on envelopes lines, it seems to count everything correctly, but the log is missing some entries - for example the log has count[Number] =3 and the next count[Number] =5. I can see that the counting is correct but the log is missing for some reasoncount [Number] =4. Sometimes the log has all the entries. I don't understand why it happens. If you see errors in the code, may you correct the code?

Also, sometimes running tester throws error " OnTick critical error " but on next start it starts testing. What could be the problem?

input string            Symb0 = "EURUSD";
input  bool            Trade0 = true;
int MA_Shift0=1;
input int MA_Per0 = 11;
input double     Envelopes_Deviation0     =0.1; 
//+-----------------------------------+
input string            Symb1 = "USDCHF";
input  bool            Trade1 = true;
int MA_Shift1=1;
input int MA_Per1 = 11;
input double     Envelopes_Deviation1     =0.1; 

bool MA (int Number,
         string  Symbol_,           // имя символа
         bool    Trade,
         int     MA_Per,         // период для расчета средней линии
         int     MA_Shift,          // смещение индикатора по горизонтали   
         double  Envelopes_Deviation,          // отклонение границ от средней линии    
         double  &Bid[],
         int &env[],
         int &count[],
         bool &flagenv[],
         bool &flagenv1[]      
        )

  {
   if(!Trade)return(true);

   static int Size_=0;

   static int Handle[];
  static int Recount[],MinBars[];
  double ma[];
  double Env_Up[2];  
double Env_Dn[2];   
 double  norm_Env_Dn;
 double  norm_Env_Up;

 
     if(Number+1>Size_) 
     {
      Size_=Number+1; 

      ArrayResize(Handle,Size_);
      ArrayResize(Recount,Size_);
      ArrayResize(MinBars,Size_);

      MinBars[Number]=3*MA_Per;

      ArraySetAsSeries(Env_Dn,true);

      Handle[Number]=iEnvelopes(Symbol_,0,MA_Per,MA_Shift,MODE_SMA,PRICE_CLOSE,Envelopes_Deviation); 
         
     }

   if(Bars(Symbol_,0)<MinBars[Number])return(true);

      if(CopyBuffer(Handle[Number],LOWER_LINE,0,2,Env_Dn)<0 || CopyBuffer(Handle[Number],UPPER_LINE,0,2,Env_Up)<0)
        {
         Recount[Number]=true; 

         return(false);  
        }
      
     
  int Digits_=int(SymbolInfoInteger(Symbol_,SYMBOL_DIGITS)+1);
  norm_Env_Dn = NormalizeDouble(Env_Dn[0], Digits_);
  norm_Env_Up = NormalizeDouble(Env_Up[0], Digits_);   
     
 Bid[Number]=SymbolInfoDouble(Symbol_,SYMBOL_BID); 
    
if(Bid[Number] < norm_Env_Dn && !flagenv1[Number]) env[Number] += 1;
if(Bid[Number] > norm_Env_Up && !flagenv[Number]) env[Number] += 2;      
if(env[Number]<=2)env[Number] *= 10;

if (env[Number]==20)flagenv[Number] = true;
if (env[Number]==10)flagenv1[Number] = true;

if(env[Number]==3 || env[Number]==12 || env[Number]==21 || env[Number]>21) 
{
env[Number]=0;
flagenv[Number] = false;
flagenv1[Number] = false;
count[Number]++;

Print("+++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@ count---------= ", count[Number],"      Number= ",Number);
}
  
  return(true);
  }
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
  static double Bid[2];
  static int env[2],count[2];
  static bool flagenv[2],flagenv1[2]; 
MA(0,Symb0,Trade0,MA_Per0,MA_Shift0,Envelopes_Deviation0,Bid,env,count,flagenv,flagenv1);
MA(1,Symb1,Trade1,MA_Per1,MA_Shift1,Envelopes_Deviation1,Bid,env,count,flagenv,flagenv1);

  }
//+------------------------------------------------------------------+

Reason: