Testare 'CopyTicks'. - pagina 13

 
prostotrader:

Come fai a sapere così tanto?

Oltre a Plaza II, c'è il protocollo FAST/FIX

Centinaia di operazioni vengono eseguite in 1 ms

La storia delle zecche dimostra che non esiste una cosa del genere nei futures RTS.
 
fxsaber:

Come può essere? Dopo tutto, anche gli HFT non possono rimuovere un ordine limite in meno di 1ms di tempo.

  • Ci sono tipi speciali di ordini di mercato che combinano diverse azioni in una volta sola (non MT5).
  • Chi dice che la discrezione delle azioni deve essere regolata da un tempo di 1ms? Ogni azione di trading è essenzialmente un record nel core dello scambio, che è un database. La scrittura sul database è molto più veloce di 1msec. Per la stessa ragione, le offerte abbinate formano lunghe sequenze di tick con tempi di occorrenza identici, fino a milionesimi di secondo. Cioè, i trade avvengono effettivamente simultaneamente (scritti nel database), anche se appaiono sul grafico come una lunga sequenza Last.
 
Vasiliy Sokolov:
  • Ci sono tipi speciali di ordini di mercato che combinano diverse azioni in una volta sola (non MT5).
  • Chi ha detto che la discrezione delle azioni deve essere regolata da tempi di 1msec? Ogni azione di trading è essenzialmente una scrittura al nucleo dello scambio, che è un database.
Non sono stati rilevati quattro tic in un millisecondo. Tre - una volta. Due - decine di centinaia di migliaia.
  • La scrittura sul database è molto più veloce di 1msec. Per la stessa ragione, le offerte abbinate formano lunghe sequenze di tick con tempi di occorrenza identici, fino a milionesimi di secondo. Cioè, i trade avvengono effettivamente simultaneamente (scritti nel database), anche se appaiono sul grafico come una lunga sequenza Last.
Il fatto è che non le pinne, ma le bande migliori sono state monitorate (COPY_TICKS_INFO). Quindi 1msec è ragionevole. Se ci sono gli HFT, dove sono? A giudicare dalla sceneggiatura, sono una specie di freni.
 
Lo script produce COPY_TICKS_INFO con zero prezzi
#property script_show_inputs

sinput int Count = 100000; // Количество тиков на проверку

#define  TOSTRING(A) " " + #A + " = " + (string)Tick.A

string TickToString( const MqlTick &Tick )
{
  static int i = 0;
  
  i++;
  
  return("Tick" + (string)i + ":" + TOSTRING(time) + "." + (string)(Tick.time_msc %1000) +
         TOSTRING(bid) + TOSTRING(ask) + TOSTRING(last)+ TOSTRING(volume));
}

void OnStart()
{
  MqlTick Ticks[];
  
  const int Amount = CopyTicks(_Symbol, Ticks, COPY_TICKS_INFO, 0, Count);
  
  for (int i = 0; i < Amount; i++)
    if ((Ticks[i].bid == 0) || (Ticks[i].ask == 0))
      Print(TickToString(Ticks[i]));
}

Risultato

2016.09.13 18:02:06.297 Test (RTS-9.16,M1)      Tick2: time = 2016.09.12 18:52:36.378 bid = 0.0 ask = 0.0 last = 98480.0 volume = 1
2016.09.13 18:02:06.297 Test (RTS-9.16,M1)      Tick1: time = 2016.09.12 18:44:59.951 bid = 0.0 ask = 0.0 last = 98480.0 volume = 1

CopyTicks bug?

 

L'indicatore mostra che CopyTicks potrebbe non dare gli ultimi tick

#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0

#define  TOSTRING(A) " " + #A + " = " + (string)Tick.A

string TickToString( const MqlTick &Tick )
{
  static int i = 0;
  
  i++;
  
  return("Tick" + (string)i + ":" + TOSTRING(time) + "." + (string)(Tick.time_msc %1000) +
         TOSTRING(bid) + TOSTRING(ask) + TOSTRING(last)+ TOSTRING(volume));
}

bool MySymbolInfoTick( const string Symb, MqlTick &Tick, const uint Type = COPY_TICKS_ALL )
{
  MqlTick Ticks[];
  const int Amount = ::CopyTicks(Symb, Ticks, Type, 0, 1);
  const bool Res = (Amount > 0);
  
  if (Res)
    Tick = Ticks[Amount - 1];
  
  return(Res);
}

int OnCalculate( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[] )
{
  MqlTick Tick1, Tick2;
  
  if (SymbolInfoTick(_Symbol, Tick2) && MySymbolInfoTick(_Symbol, Tick1))
    if (Tick1.time_msc != Tick2.time_msc)
      Print(TickToString(Tick1) + "\n" + TickToString(Tick2) + "\n");
  
  return(rates_total);
}

Risultato

2016.09.14 12:55:23.047 Test2 (Si-9.16,M1)      Tick250: time = 2016.09.14 12:55:04.521 bid = 64999.0 ask = 65002.0 last = 65002.0 volume = 2
2016.09.14 12:55:23.047 Test2 (Si-9.16,M1)      Tick249: time = 2016.09.14 12:55:04.513 bid = 64999.0 ask = 65002.0 last = 65002.0 volume = 2
 
fxsaber:
Lo script produce COPY_TICKS_INFO con zero prezzi

Risultato

CopyTicks bug?

Anche le bandiere di uscita
 
Slawa:
Emettere anche le bandiere

Per esempio

string GetTickFlag(uint tickflag)
  {
   string flag="";
//---
   if((tickflag&TICK_FLAG_BID)==TICK_FLAG_BID)
      flag=flag+"TICK_FLAG_BID";

   if((tickflag&TICK_FLAG_ASK)==TICK_FLAG_ASK)
      flag=flag+" TICK_FLAG_ASK";

   if((tickflag&TICK_FLAG_LAST)==TICK_FLAG_LAST)
      flag=flag+" TICK_FLAG_LAST";

   if((tickflag&TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME)
      flag=flag+" TICK_FLAG_VOLUME";

   if((tickflag&TICK_FLAG_BUY)==TICK_FLAG_BUY)
      flag=flag+" TICK_FLAG_BUY";

   if((tickflag&TICK_FLAG_SELL)==TICK_FLAG_SELL)
      flag=flag+" TICK_FLAG_SELL";
   if(StringLen(flag)==0)
      return("FLAG_UNKNOWN");
   return(flag);
  }
//+------------------------------------------------------------------+
 
Slawa:
Emettere anche le bandiere

Corretto

#property script_show_inputs

sinput int Count = 1000000; // Количество тиков на проверку

#define  TOSTRING(A) " " + #A + " = " + (string)Tick.A

string TickToString( const MqlTick &Tick )
{
  static int i = 0;
  
  i++;
  
  return("Tick" + (string)i + ":" + TOSTRING(time) + "." + (string)(Tick.time_msc %1000) +
         TOSTRING(bid) + TOSTRING(ask) + TOSTRING(last)+ TOSTRING(volume) + TOSTRING(flags));
}

void OnStart()
{
  MqlTick Ticks[];
  
  const int Amount = CopyTicks(_Symbol, Ticks, COPY_TICKS_INFO, 0, Count);
  
  for (int i = 0; i < Amount; i++)
    if ((Ticks[i].bid == 0) || (Ticks[i].ask == 0))
      Print(TickToString(Ticks[i]));
}

Risultato su BCS-MetaTrader5

2016.09.14 13:37:03.896 Test (Si-9.16,M1)       Tick23: time = 2016.09.13 18:52:35.505 bid = 0.0 ask = 0.0 last = 65253.0 volume = 35 flags = 6
2016.09.14 13:37:03.896 Test (Si-9.16,M1)       Tick22: time = 2016.09.13 18:44:59.978 bid = 0.0 ask = 0.0 last = 65253.0 volume = 35 flags = 6
2016.09.14 13:37:03.895 Test (Si-9.16,M1)       Tick21: time = 2016.09.13 00:02:36.809 bid = 0.0 ask = 0.0 last = 0.0 volume = 0 flags = 6
2016.09.14 13:37:03.895 Test (Si-9.16,M1)       Tick20: time = 2016.09.13 00:02:36.809 bid = 0.0 ask = 0.0 last = 0.0 volume = 0 flags = 6
2016.09.14 13:37:03.895 Test (Si-9.16,M1)       Tick19: time = 2016.09.12 18:52:35.635 bid = 0.0 ask = 0.0 last = 64721.0 volume = 2 flags = 6
2016.09.14 13:37:03.895 Test (Si-9.16,M1)       Tick18: time = 2016.09.09 18:52:09.8 bid = 0.0 ask = 0.0 last = 64729.0 volume = 43 flags = 6
2016.09.14 13:37:03.895 Test (Si-9.16,M1)       Tick17: time = 2016.09.09 18:44:59.923 bid = 0.0 ask = 0.0 last = 64729.0 volume = 43 flags = 6
2016.09.14 13:37:03.894 Test (Si-9.16,M1)       Tick16: time = 2016.09.08 23:53:05.468 bid = 0.0 ask = 0.0 last = 64118.0 volume = 1 flags = 6
2016.09.14 13:37:03.894 Test (Si-9.16,M1)       Tick15: time = 2016.09.08 18:51:59.107 bid = 0.0 ask = 0.0 last = 63870.0 volume = 99 flags = 6
2016.09.14 13:37:03.894 Test (Si-9.16,M1)       Tick14: time = 2016.09.08 18:44:59.570 bid = 0.0 ask = 0.0 last = 63870.0 volume = 99 flags = 6
2016.09.14 13:37:03.893 Test (Si-9.16,M1)       Tick13: time = 2016.09.07 23:56:45.427 bid = 0.0 ask = 0.0 last = 64263.0 volume = 1 flags = 6
2016.09.14 13:37:03.893 Test (Si-9.16,M1)       Tick12: time = 2016.09.07 18:52:00.724 bid = 0.0 ask = 0.0 last = 64472.0 volume = 6 flags = 6
2016.09.14 13:37:03.893 Test (Si-9.16,M1)       Tick11: time = 2016.09.07 18:44:59.713 bid = 0.0 ask = 0.0 last = 64472.0 volume = 6 flags = 6
2016.09.14 13:37:03.893 Test (Si-9.16,M1)       Tick10: time = 2016.09.06 23:53:48.388 bid = 0.0 ask = 0.0 last = 64720.0 volume = 1 flags = 6
2016.09.14 13:37:03.893 Test (Si-9.16,M1)       Tick9: time = 2016.09.06 23:53:48.388 bid = 0.0 ask = 0.0 last = 64720.0 volume = 1 flags = 6
2016.09.14 13:37:03.893 Test (Si-9.16,M1)       Tick8: time = 2016.09.06 18:53:15.598 bid = 0.0 ask = 0.0 last = 64679.0 volume = 5 flags = 6
2016.09.14 13:37:03.893 Test (Si-9.16,M1)       Tick7: time = 2016.09.06 18:44:59.960 bid = 0.0 ask = 0.0 last = 64679.0 volume = 5 flags = 6
2016.09.14 13:37:03.892 Test (Si-9.16,M1)       Tick6: time = 2016.09.05 23:59:06.607 bid = 0.0 ask = 0.0 last = 65225.0 volume = 3 flags = 6
2016.09.14 13:37:03.892 Test (Si-9.16,M1)       Tick5: time = 2016.09.05 23:59:06.607 bid = 0.0 ask = 0.0 last = 65225.0 volume = 3 flags = 6
2016.09.14 13:37:03.892 Test (Si-9.16,M1)       Tick4: time = 2016.09.05 23:59:03.529 bid = 0.0 ask = 0.0 last = 65225.0 volume = 3 flags = 6
2016.09.14 13:37:03.892 Test (Si-9.16,M1)       Tick3: time = 2016.09.05 23:54:00.315 bid = 0.0 ask = 0.0 last = 65225.0 volume = 3 flags = 6
2016.09.14 13:37:03.892 Test (Si-9.16,M1)       Tick2: time = 2016.09.05 18:51:40.877 bid = 0.0 ask = 0.0 last = 65178.0 volume = 2 flags = 6
2016.09.14 13:37:03.892 Test (Si-9.16,M1)       Tick1: time = 2016.09.05 18:44:59.998 bid = 0.0 ask = 0.0 last = 65178.0 volume = 2 flags = 6
 
fxsaber:

Risultato su BCS-MetaTrader5

È reale o demo? C'era qualcosa di simile sui conti demo, se ricordo bene.
 
Rashid Umarov:
È reale o demo? C'era qualcosa di simile sui conti demo, se ricordo bene.

Reale. Non riesci a riprodurlo?