Libraries: MultiTester - page 44

 

Forum on trading, automated trading systems and testing trading strategies

Testing 'CopyTicks'

fxsaber, 2024.02.26 12:41 pm

If CopyTicks hangs for 60 seconds and returns error 4403, try to change the access point to the server. Even if the ping to it is less favourable.

In this sense, automatic selection of an access point by the terminal is dangerous.

Without launching this indicator (one instance for the whole Terminal), I no longer leave the combat Terminal, where work with CopyTicks is going on.

#include <fxsaber\MultiTester\MTTester.mqh> // https://www.mql5.com/ru/code/26132

#property indicator_chart_window
#property indicator_plots 0

input int inIntervalAlert = 5; // Error timeout interval (sec)
input int inMaxPoints = 5;     // Number of first server points

int OnCalculate( const int rates_total, const int prev_calculated, const int, const double &[] )
{
  static ulong StartTime = GetTickCount64();
  const ulong CurrTime = GetTickCount64();
  
  if (!prev_calculated)
  {
    Alert("Restarted!");
    
    StartTime = CurrTime;
  }
  else if (CheckCopyTicks() != ERR_HISTORY_TIMEOUT)
    StartTime = CurrTime;
  else if (CurrTime - StartTime > (ulong)inIntervalAlert * 1000)
  {
    static int Pos = 0;
    
    const int ServerPoint = Pos++ % inMaxPoints;
        
    Alert("CopyTicks error (timeout > " + (string)(CurrTime - StartTime) +
          " ms). Trying (" + (string)Pos + ") to switch to the " +
          (string)(ServerPoint + 1) + "/" + (string)inMaxPoints + " server point.");

    MTTESTER::SetServerPoint(ServerPoint);
  }

  return(rates_total);
}

int CheckCopyTicks( const string Symb = NULL )
{
  MqlTick Tick;
  MqlTick Ticks[];
  
  ResetLastError();
  
  if (SymbolInfoTick(Symb, Tick))
    CopyTicks(Symb, Ticks, COPY_TICKS_ALL, Tick.time_msc - 1000000, 1);
    
  return(_LastError);
}


2024.10.29 16:07:24.802 CopyTicksHelper (EURUSD,M1)     Alert: CopyTicks error (timeout > 5015 ms). Trying (8) to switch to the 3/5 server point.
2024.10.29 16:07:25.909 CopyTicksHelper (EURUSD,M1)     Alert: Restarted!


The indicator makes all running Expert Advisors/scripts exit the corresponding timeout error at once. And then they continue to work normally.

 
fxsaber #:

Without running this indicator (one instance for the whole Terminal), I no longer leave the combat Terminal, where the work with CopyTicks is going on.



The indicator forces all running Expert Advisors/scripts to exit the corresponding timeout error at once. And then they continue to work normally.

Please give me real cases when you need to work with CopyTicks in an Expert Advisor all the time. I really use it only in OnInit() to get some historical ticks to run digital filters. In MQL4 I had to wait several minutes for buffers to fill up.

 
Alexey Volchanskiy #:

Please give me real cases when you need to work with CopyTicks in your Expert Advisor all the time.

Do not skip (and do not double) ticks on Real, as it happens in Tester. The Expert Advisor on Real receives exactly the same sequence of price data that it will receive in Tester when you decide to run it on the past interval in the future.

 

I must be a complete idiot or missing something.

If I have an EA which I would like to run a single non-visual test (not-optimisation) of each day for a year...So Each day is tested with the hardcoded parameters how would I do It? Could someone please write a short tutorial like.

1. Download library - Install Instructions

2. Write this code to select your EA by name in your ea and such and such a file.

3. Select your start and end dates here

4. Specify Period and length of each back test here.

5. Add these additional codes to make everything function correctly get your #includes in the right place etc

6. Specify and save results to csv for each daily backtest.

Etc etc etc etc

I am lost on how to implement this soslution which seems like this library is specifically built for @fxsaber I have read all your short examples and went over the code in each file and cant seem to find any documentation that describes use cases or a step by step guide anywhere could you please help me figure this out?


Thanks for coding what we all wanted and needed your a legend love some of your comments like "!Did" when someone is asking you to fix something

 
CheckInputs - нахождение аварийных проходов при Оптимизации советника
CheckInputs - нахождение аварийных проходов при Оптимизации советника
  • www.mql5.com
Во время Оптимизации советника некоторые проходы могут завершаться аварийно. Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий Новая версия платформы MetaTrader 5
 

Forum on trading, automated trading systems and testing trading strategies

Libraries: MultiTester

fxsaber, 2022.12.12 13:20

Sometimes you need to do the same thing on working terminals. Automation of this action below on the example.

As a result, one click collected data from all terminals. Thanks to MTTESTER::RunEX5 - runs EX5 on the required terminal (portable).

Application.

МультиТерминальный скрипт.
МультиТерминальный скрипт.
  • www.mql5.com
Здесь будет представлен новый вид MQL5-программ - мультитерминальный скрипт: скрипт, который сам запускается на всех открытых MT5-терминалах. Пример. Первым таким скриптом стал CustomReport по причине
 

The script shows which of the running terminals are portable.

#include <fxsaber\MultiTester\MTTester.mqh> // https://www.mql5.com/ru/code/26132
  
void OnStart()
{
  HANDLE Handles[];
  
// Run through all the terminals
  for (int i = MTTESTER::GetTerminalHandles(Handles, false); (bool)i--;)
    Print("\"" + MTTESTER::GetTerminalPath(Handles[i]) +
          "\" - " +(MTTESTER::IsPortable(Handles[i]) ? "portable." : "NOT portable."));
}
 

Hi

I need running a script(located in \MQL5\Scripts\) by clicking on an object created by an indicator (located in \MQL5\Indicators\)(not by Hotkeys).

I have tried to use MTTESTER::RunEX5 but there are lots of basic errors. What am I doing wrong?

I have past "MultiTester_Example1" and "MultiTester_Example2" in \MetaQuotes\Terminal\D..5\MQL5\Experts\fxsaber\MultiTester.

I have past "MultiTester.mqh" and all other .mqh files in \MetaQuotes\Terminal\D..5\MQL5\Include\fxsaber\MultiTester

these are the errors I have received

in EX1:

'sinput' - unexpected token Ex1.mq5 3 1

'=' - illegal assignment use Ex1.mq5 3 23

'sinput' - unexpected token Ex1.mq5 4 1

'=' - illegal assignment use Ex1.mq5 4 23

'sinput' - unexpected token Ex1.mq5 5 1

'=' - illegal assignment use Ex1.mq5 5 24

'sinput' - unexpected token Ex1.mq5 6 1

'=' - illegal assignment use Ex1.mq5 6 31


in EX2:

event handling function not found Ex2.mq5 1 1


in MultiTester.mqh:

expression not boolean TesterSettings.mqh 104 37

expression not boolean TesterSettings.mqh 118 39

'SetTesterSettings' - undeclared identifier MultiTester.mqh 43 13

')' - expression expected MultiTester.mqh 43 31

'SetTesterSettings' - undeclared identifier MultiTester.mqh 51 10

')' - expression expected MultiTester.mqh 51 28


in Task.mqh:

file 'C:\Users\...\...\....\...\Terminal\D0...75\MQL5\Include\fxsaber\TesterCache\TesterCache.mqh' not found Task.mqh 5 11

'TESTERCACHE' - declaration without type Task.mqh 80 38

.

.

.

see template instantiation 'MTTESTER::TASK::GetMaxFitnessPos<unknown>' Task.mqh 244 29


 
Asa Social #:

I need running a script(located in \MQL5\Scripts\) by clicking on an object created by an indicator (located in \MQL5\Indicators\) (not by Hotkeys).

See the example here.

I have tried to use MTTESTER::RunEX5 but there are lots of basic errors. What am I doing wrong?

Uncompiled code technically cannot be published in Codebase. The problem is on your side.
Библиотеки: Expert - Попробуйте использовать ChartApplyTemplate. Запустите советник на всех чартах, где уже есть запущенный советник.
Библиотеки: Expert - Попробуйте использовать ChartApplyTemplate. Запустите советник на всех чартах, где уже есть запущенный советник.
  • 2017.08.28
  • Automated-Trading
  • www.mql5.com
После этого задать ему нормальное значение через ChartSetInteger. Если же нужно еще и советник запустить на том же чарте. а оттуда запускать на нужном уже нам чарте советник. Библиотека работает без DLL - полностью удовлетворяет требованиям Маркета
 

Forum on trading, automated trading systems and testing trading strategies

Libraries: MultiTester

fxsaber, 2022.12.12 13:20

MTTESTER::RunEX5 - runs EX5 on the required terminal (portable).

portable-restriction removed.