Solo gli utenti che hanno acquistato o noleggiato il prodotto possono lasciare commenti
Aliaksandr Hryshyn  

Не забываем предварительно подготовить и сохранить тайминги отдельным прогоном в тестере. При изменении параметров влияющих на тики(время, моделирование, добавление/удаление инструментов) необходимо повторно создать файл таймингов.

Aliaksandr Hryshyn  

Source code on video

//+------------------------------------------------------------------+
//|                                            Test_market_depth.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#include <Greshnik\\Market\\Market_book_synhron_lib.mqh>

sinput bool wr_events=false;//Enable saving/using timings
sinput bool external_control=true;//Enable external control
input string symbol_name_0="EURUSD";//Instrument 0
input string server_name_0;//Server 0
input string symbol_name_1="Si-3.22";//Instrument 1
input string server_name_1="Open-Broker";//Server 1
input string symbol_name_2="AUDUSD";//Instrument 2
input string server_name_2;//Server 2
input string symbol_name_3="GBPUSD";//Instrument 3
input string server_name_3;//Server 3

string my_symbols_active[][2];
MqlBookInfo my_price_array[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
   if(!cMBS_Write_read_events(wr_events))//Enable saving/using timings
     {
      Print("There are no timings, you must first get them when running the tester with the 'Enable saving/using timings' option enabled");
      return INIT_FAILED;
     }
   int my_symbols_active_len=0;
   string symbols[]= {symbol_name_0,symbol_name_1,symbol_name_2,symbol_name_3};
   string servers[]= {server_name_0,server_name_1,server_name_2,server_name_3};
   for(int i1=0; i1<ArrayRange(symbols,0); i1++)
     {
      if(StringLen(symbols[i1])>0)
        {
         if(cMBS_Sy_MarketBookAdd(symbols[i1],servers[i1]))
           {
            ArrayResize(my_symbols_active,my_symbols_active_len+1);
            my_symbols_active[my_symbols_active_len][0]=servers[i1];
            my_symbols_active[my_symbols_active_len][1]=symbols[i1];
            if(!wr_events && MQLInfoInteger(MQL_VISUAL_MODE))
              {
               cMBS_Set_visual(symbols[i1],true,servers[i1]);//Turn on visualization
               //For Depth of Market we define parameters
               int x=my_symbols_active_len*302;

               cMBS_Set_visual_property(symbols[i1],mdp_pos_x,x,servers[i1]);

               cMBS_Set_visual_property(symbols[i1],mdp_size_x,300,servers[i1]);

               cMBS_Set_visual_property(symbols[i1],mdp_minimized_pos_x,my_symbols_active_len*300,servers[i1]);
               cMBS_Set_visual_property(symbols[i1],mdp_minimized_pos_y,10,servers[i1]);
               
               cMBS_Set_visual_property(symbols[i1],mdp_color_back,clrAzure,servers[i1]);


              }
            my_symbols_active_len++;
           }
        }
     }

//Getting information about symbols
   int len1=ArrayRange(my_symbols_active,0);
   for(int i1=0; i1<len1; i1++)
     {
      Print(my_symbols_active[i1][1],"(",my_symbols_active[i1][0],")");
      Print(" digits=",cMBS_Get_symbol_digits(my_symbols_active[i1][1],my_symbols_active[i1][0]));
      Print(" point=",cMBS_Get_symbol_point(my_symbols_active[i1][1],my_symbols_active[i1][0]));
      Print(" tick_size=",cMBS_Get_symbol_tick_size(my_symbols_active[i1][1],my_symbols_active[i1][0]));
     }

   cMBS_Set_external_control(external_control);//External control
   cMBS_Set_visual_time_real_mul(1);//Real time simulation
//cMBS_Set_visual_time_real_mul(0.5);//Two times faster
//cMBS_Set_visual_time_real_mul(0.333);//Three times faster
   cMBS_Set_OnBookEvent_handler(Sy_OnBookEvent);//Define an event handler for changing the Depth of Market
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
//Put your code here
//...
//..
   cMBS_Sy_OnTick();
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   cMBS_Save_events();//Save timings to a file
   int len1=ArrayRange(my_symbols_active,0);
   for(int i1=0; i1<len1; i1++)
     {
      cMBS_Sy_MarketBookRelease(my_symbols_active[i1][0],my_symbols_active[i1][1]);
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Sy_OnBookEvent(const string& symbol, const string& server_name)
  {
//Getting information about symbols
   /*Print(symbol,"(",server_name,")");
   Print(" interest=",cMBS_Get_symbol_interest(symbol,server_name));
   Print(" buy_volume=",cMBS_Get_symbol_buy_volume(symbol,server_name));
   Print(" sell_volume=",cMBS_Get_symbol_sell_volume(symbol,server_name));*/

   cMBS_Sy_MarketBookGet(symbol,my_price_array,server_name);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnBookEvent(const string& symbol)
  {

  }
//+------------------------------------------------------------------+
Aliaksandr Hryshyn  

Version   1.2

bool cMBS_Sy_MarketBookAdd(
   const string symbol_name,//Instrument
   string server_name=NULL,//Server name. NULL=current server
   int time_shift=0//Time offset in ms. The event will occur at the specified time later
);
Aliaksandr Hryshyn  
A utility for unpacking/packing files, it is also an example of using the corresponding function
File:
Zip_zip.mq5  7 kb
Aliaksandr Hryshyn  

Версия для оптимизациия, использует dll . Эффективное использование оперативной памяти. Копия данных стакана только одна для каждого сивола, независимо от количества агентов тестирования на машине. Значительно быстрее работает по причине отсутсвия необходимости подготовки данных. Не работает на Windows 7.

Библиотека, включаемый файл и тестовый советник прилагается.

Version for optimization, uses dll . Efficient use of RAM. There is only one copy of DOM data for each character, regardless of the number of testing agents on the machine. Works much faster due to the lack of the need for data preparation. Doesn't work on Windows 7.

The library, include file and test EA are attached.

Solo gli utenti che hanno acquistato o noleggiato il prodotto possono lasciare commenti