What about making Expert working on another chart?

 

Hello

At MQL5

What about making Expert working on another chart?

for ex: running my expert at (EURUSD chart M5 timefram), and it must opening all positions at (EURCAD,EURAUD....,15M,H1 ....etc)

Is this possible ?

How can i do this on this code:


// ----- > column_table < ----------

// $name = name symbol .
// $stimeframe = time frame expert // example  ( eurusd, 15m ...)
// $section = ادخال يدوي
// $stitle = ادخال يدوي





//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

#property copyright "https://t.me/top369"
#property link      "ikoder@hotmail.com"
int MA_handle;
double MA[];
int RSI_handle;
double RSI[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
#property strict

#include <MQLMySQL.mqh>
int DB; // database identifier

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
MA_handle = iMA(NULL, PERIOD_CURRENT, 14, 0, MODE_SMA, PRICE_CLOSE);
   if(MA_handle < 0)
     {
      Print("The creation of iMA has failed: MA_handle=", INVALID_HANDLE);
      Print("Runtime error = ", GetLastError());
      return(INIT_FAILED);
     }
   
   RSI_handle = iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE);
   if(RSI_handle < 0)
     {
      Print("The creation of iRSI has failed: RSI_handle=", INVALID_HANDLE);
      Print("Runtime error = ", GetLastError());
      return(INIT_FAILED);
     }
   


   IsConnectedDB=false;


   return (INIT_SUCCEEDED);
  }


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   MySqlDisconnect(DB);

  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
   int symbols_size=ArraySize(symbols);
   int timeframes_size=ArraySize(TimeFrames);

   for(int i=0; i<symbols_size; i++)
     {
      for(int tf=0; tf<timeframes_size; tf++)
        {
         Run(symbols[i],TimeFrames[tf]);
        }
     }

  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+


// #######################################################



string symbols[]= {"GBPUSD","GBPCAD","GBPNZD","GBPAUD","GBPJPY","EURGBP","EURUSD","EURCAD","EURNZD","EURAUD","EURJPY","CADJPY","NZDJPY","AUDJPY","USDJPY","AUDUSD","AUDCAD","AUDNZD","NZDCAD","NZDUSD","USDCAD"};
ENUM_TIMEFRAMES TimeFrames[]={PERIOD_CURRENT};



// #######################################################

bool IsConnectedDB;
void Run(string symbol,ENUM_TIMEFRAMES time_frame)
  {

   string Host, User, Password, Database, Socket; // database credentials
   int Port,ClientFlag;


   if(!IsConnectedDB)
     {
      Print(MySqlVersion());

      Host="162.241.194.194";
      User="m1m02928_mysignal";
      Password="Cc9208312@";
      Database="m1m02928_mysignal";
      Port=3306;
      Socket="0";
      ClientFlag=0;

      Comment("Connecting to DB..."+"\nHost: "+Host);

      DB = MySqlConnect(Host, User, Password, Database, Port, Socket, ClientFlag);

      if(DB == -1)
        {
         Alert("Connection failed! Error: "+MySqlErrorDescription);
         return;
        }
      else
        {
         IsConnectedDB=true;
         Alert("Connected! DBID#",DB);
        }
     }

   if(IsConnectedDB)
     {

      //Example insert one row
      /* string query="INSERT INTO `signal` (name) VALUES (4)";

       if(MySqlExecute(DB, query))
         {
          int rows_affected=MySqlRowsAffected(DB);
          Alert("Successfully Executed, effected rows#",rows_affected);
         }
       else
         {
          Alert("Error sending query Error: #",MySqlErrorNumber,"- ", MySqlErrorDescription," \n",query);
          if(StringFind(MySqlErrorDescription,"No connection to the database",0)>=0||StringFind(MySqlErrorDescription,"MySQL server has gone away",0)>=0)
            {
             IsConnectedDB=false;
            }
         }*/


      //Example insert Multiple rows
      int cnt=0;
      string values="";
      
      
      //  start   #######################################################
      
      
      for(int i=1; i<=8; i++)
        {
        
        
        
         if(RSI[i]>RSI[1+i]+15)
           {
            if(cnt>0)
               values+=",";
            string close_price=DoubleToString(iClose(symbol,time_frame,i),Digits());
            values+=StatementValues(close_price);
            cnt++;
           }

        }
        
        
        
        // end #######################################################
        
        
        

      string query=getQuery(values);


      if(MySqlExecute(DB, query))
        {
         int rows_affected=MySqlRowsAffected(DB);
         Alert("Successfully Executed, effected rows#",rows_affected);
        }
      else
        {
         Alert("Error sending query Error: #",MySqlErrorNumber,"- ", MySqlErrorDescription," \n",query);
         if(StringFind(MySqlErrorDescription,"No connection to the database",0)>=0||StringFind(MySqlErrorDescription,"MySQL server has gone away",0)>=0)
           {
            IsConnectedDB=false;
           }
        }
     }

  }


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string StatementValues(string price)
  {
   return "(\'" + price + "\'"  + ")";
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string getQuery(string values)
  {

   string sql = "INSERT INTO `tadawul` (name) VALUES "+values
                + " ON DUPLICATE KEY UPDATE "
                + " name=VALUES(name)";


   return sql;
  }

//+------------------------------------------------------------------+