Expert – library MetaTrader 5

The library can be connected using

#include <fxsaber\Expert.mqh>

All other files on this page provide examples/scenarios of library application; they are not needed for the operation of the library.

Features

// Is the Expert Advisor running on the appropriate chart?
bool EXPERT::Is( const long Chart_ID = 0 );

// Deletes the Expert Advisor form the appropriate chart
bool EXPERT::Remove( const long Chart_ID = 0 );

// Restarts the Expert Advisor on the appropriate chart
bool EXPERT::Reopen( const long Chart_ID = 0 );

// Retrieves data of the EA running on the appropriate chart
bool EXPERT::Parameters( const long Chart_ID,    
                         MqlParam &Parameters[], // Path to the EA and values of its input parameters
                         string &Names[] );      // Names of input parameters

// Launches the EA on the appropriate chart
bool EXPERT::Run( const long Chart_ID,    
                  MqlParam &Parameters[] ); // Path to the EA and values of its input parameters

Example

The library use examples/scenarios are attached to the description.

  • ExpertsRemove.mq5

    // Removes from all charts running Expert Advisors
  • ExpertsReopen.mq5

    // Restarts running Expert Advisors
  • ChartsClose.mq5

    // Closes all charts, on which there are no Expert Advisors (convenient for VPS)
  • ExpertLoader_Example.mq5 (in the source file, you can see how the Expert Advisor is launched, as well as how the script starts itself as an EA)

    // Starts an Expert Advisor with specified parameters
  • ExpertsChange_Example.mq5

    // Restarts running Expert Advisors and changes their input parameters

The above examples are the simplest scenarios of library use. It can also be useful in the development of various control panels, from which charts/Expert Advisors are managed, etc.

Alternative:  SpreadCandlesCreator - indicator MetaTrader 5

For a better understanding of how to use the library, here is a short source code:

// Starts an Expert Advisor with specified parameters
#include <fxsaber\Expert.mqh>

void OnStart()
{
  MqlParam Params[2];
  
  // Path to the Expert Advisor
  Params[0].string_value = "Experts\\Advisors\ExpertMACD.ex5";

  // The first input parameter of the Expert Advisor
  Params[1].type = TYPE_STRING;
  Params[1].string_value = "Hello World!";

  // Launching the Expert Advisor on the new chart
  EXPERT::Run(ChartOpen(_Symbol, _Period), Params);
}


📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks