Is it possible to write an EA to scan all the currency pairs and commodities and then find the one with the most strong trend in MT4?

 

HI, all. Is it possible to write an EA to scan all the currency pairs and commodities and then find the one with the most strong trend in MT4?I 

I am still new to MT4. MY current intention is to analyze mutiple time frames for each currency pair and commodities.  and then to select the one with the strongest trend. Now, I intend to do this by ADX. japanese candlstick pattern, etc. I wonder whether my idea is viable in MT4? THanks a lot for your feedback and suggestions....

 

sure, best is to make an array with symbols:

String symbols[]={"Eurusd","Usdjpy",...);

and then iterate over the array

for(int i=0;i<ArraySize(symbols);i++){
 value_for_symbol=iadx(symbols[i]....);
}
 

zzuegg:

sure, best is to make an array with symbols:

and then iterate over the array

HI, all. thanks for your suggestionsa and guidance. I have found more information about obtaining the list for all symbols that the current account can trade in the two links below:

https://www.mql5.com/en/code/9102
https://www.mql5.com/en/code/8317

Hopefully it will be useful who have the same intention as i did....

 

 
Part you asked (without commodities - only Fx), from my file:
/***/
bool rang_O_done()
 {
  if(timerCharts()) return(0);
  int sp;
  double val[], oval, hi,lo;
  ArrayInitialize(stlo,0.0);
  for(int s=0;s<size;s++) // stoploss as average bar
   {
    for(int p=0;p<chartsUse;p++)
     {
      sp=s*p+p;
      hi=iMA(sym[s],per[p],10,0,2,PRICE_HIGH,1);
      lo=iMA(sym[s],per[p],10,0,2,PRICE_LOW,1);
      stlo[sp]=2*(hi-lo);
     }
   }
  ArrayResize(val, size*chartsUse);
  ArrayInitialize(val,0.0);
  del=chartsUse;
  for(s=0;s<size;s++)
   { // value on every bar by lot--time--return
    symInfo(sym[s]);
    for(p=0;p<chartsUse;p++)
     {
      sp=s*p+p;
      if(!(0.5*stlo[sp]>2*mi[13]) || !(0.5*stlo[sp]>2*mi[33])) continue;
      if(p<chartsUse-1)
       {
        if(!(0.5*stlo[sp+1]>3*mi[13]) || !(0.5*stlo[sp+1]>3*mi[33])) continue;
        // confirm-search trend       
        if(stlo[sp+1]<2*stlo[sp]) continue;
       }
      val[sp]=stlo[sp]/mi[11]*mi[16]/(0.5*per[p+1])*orderLots(sym[s],stlo[sp]);// adapt it if other than Fx...
      if(p<del) del=p; // time for re-calculate
     }
   }
  act=1;
  ArrayInitialize(rang,-1.0);
  for(s=0;s<size*chartsUse;s++) // sort by val[] in rang[]
   { 
    oval=0.0;
    sp=-1;
    for(p=0;p<size*chartsUse;p++)
     {
      if(rang[p]>-0.5) continue;
      if(val[p]>oval)
       {
        oval=val[p]; 
        sp=p;
       }
     }
    if(oval>0.0 && sp>-1) 
     {
      rang[sp]=s;
      val[sp]=-1;
      act=s+1;
     }
    else break;
   }
  return(0);
 }
 
From my old file on old USB's , not lost ;-). I used "freaky" arrays you may need to adapt them by your array needs. Just idea if you need Em.
Reason: