Libraries: MultiTester - page 9

 
fxsaber:

Now complete freedom to automate the Tester.

One of the real application examples (everything is done automatically)

  1. All symbols are taken and the following steps are done for each symbol.
  2. I start Optimisation.
  3. At the end of the best pass data are taken and from them are formed (set ranges of input parameters) several tasks for optimisation.
  4. All optimisations from item 3 are carried out.
  5. The best passes are taken from all optimisations from item 4 and saved as sets for portfolio trading.


It turned out to be a very powerful market scanner and TS adjuster. TC sources are not required for such manipulations.

 
// Example of loading a Set-file into the Tester.
#property script_show_inputs

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

input string inFileName = "SetFile.set"; // Set-file

string FileToString( const string FileName )
{
  ushort Buffer[];
  
  return(FileLoad(FileName, Buffer) ? ShortArrayToString(Buffer) : NULL);
}

void OnStart()
{  
  MTTESTER::SetSettings("[TesterInputs]\n" + FileToString(inFileName));
}
Similarly with the Tester's ini files.
 
Thank you
 
The library has been updated for MT5 build2209+.
 
fxsaber:

It turned out to be a very powerful market scanner and TS adjuster.

#property script_show_inputs

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

input bool OnlyCustomSymbols = true; // Custom characters only
input bool AllSymbols = false;       // All characters or current

void Add( const string SymbName )
{
  TesterSettings.Add(NULL, SymbName, 0, 0, 0, TASK::InitBase, TASK::DeinitBase);

  for (int i = 0; i < ::inAmount; i++)
    TesterSettings.Add(NULL, NULL, 0, 0, 0, TASK::InitSub, TASK::DeinitSub);
}

// This function is responsible for generating the task list.
void SetTesterSettings()
{
  if (AllSymbols)
    // Search all symbols from the Market Watch.
    for (int i = SymbolsTotal(true) - 1; i >= 0; i--)
    {
      const string Name = SymbolName(i, true);

      if (!OnlyCustomSymbols || SymbolInfoInteger(Name, SYMBOL_CUSTOM))
        Add(Name);
    }
  else if (!OnlyCustomSymbols || SymbolInfoInteger(_Symbol, SYMBOL_CUSTOM))
    Add(_Symbol);
}


The Expert Advisor should have

sinput int inMinTrades = 500; // Minimum number of trades (positions).
sinput int inMaxTrades = 90000; // Maximum number of trades (positions).

double OnTester()
{
  return(((TesterStatistics(STAT_TRADES) >= inMinTrades) && (TesterStatistics(STAT_TRADES) <= inMaxTrades)) ? TesterStatistics(STAT_PROFIT) : 0);
}
 
Got round a few pitfalls. Updated.
 

I don't know about previous versions. But the latest version can run a test for the same instrument several times.

Done appears in the log, then empty (Start does not appear), and the terminal has started a new pass at the same time. It seems to be that else if (IsRun = (Init = TesterSettings.Init(Pos)) && TesterSettings.Run(Pos)) returns false, because TesterSettings.Run(Pos) returned false. And on the next timer pass else if (MTTESTER::IsReady()) will return false, which will make it loop around waiting. TesterSettings.Run(Pos)) itself returns false, it seems to be trivial because of timeout, i.e. it just doesn't wait and exits.

 

traveller00:

TesterSettings.Run(Pos)) returns false seems to be trivial due to timeout, i.e. it just doesn't wait and exits.

If so, try increasing this number

  static bool ClickStart( const bool Check = true, const int Attempts = 5 )

I've never had a case when the Start button didn't turn into a Stop button for a long time after pressing it.


I ran Example3 for a hundred characters and everything worked fine.

 
Yes, that's what I did for myself, I increased it to 50. But just in case someone else will have a similar problem or want to tweak it in the general version.
 
traveller00:
Yes, that's what I did for myself, I increased it to 50. But just in case someone else will have a similar problem or want to tweak it in the general version.

Put logging of the number of attempts that it took to change the status of the button. Interesting results.


ZY Perhaps this bug still affects.